From 66ef73b96e38c87a84ae64bd19385d5d5e9e07ed Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 10 May 2022 15:34:07 -0400 Subject: [PATCH] 19109: Add test case for discovering & uploading secondary files Correctly find secondary files in the optional "File?" case Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- .licenseignore | 1 + sdk/cwl/arvados_cwl/runner.py | 3 +++ sdk/cwl/tests/19109-upload-secondary.cwl | 22 +++++++++++++++++++ sdk/cwl/tests/19109-upload-secondary.yml | 7 ++++++ .../tests/19109-upload-secondary/file1.txt | 1 + .../19109-upload-secondary/file1.txt.tbi | 1 + sdk/cwl/tests/arvados-tests.yml | 13 +++++++++++ sdk/cwl/tests/cat2.cwl | 17 ++++++++++++++ 8 files changed, 65 insertions(+) create mode 100644 sdk/cwl/tests/19109-upload-secondary.cwl create mode 100644 sdk/cwl/tests/19109-upload-secondary.yml create mode 100644 sdk/cwl/tests/19109-upload-secondary/file1.txt create mode 100644 sdk/cwl/tests/19109-upload-secondary/file1.txt.tbi create mode 100644 sdk/cwl/tests/cat2.cwl diff --git a/.licenseignore b/.licenseignore index 387aeda944..203c378bdc 100644 --- a/.licenseignore +++ b/.licenseignore @@ -50,6 +50,7 @@ docker/jobs/1078ECD7.key */script/rails sdk/cwl/tests/input/blorp.txt sdk/cwl/tests/tool/blub.txt +sdk/cwl/tests/19109-upload-secondary/* sdk/cwl/tests/federation/data/* sdk/cwl/tests/fake-keep-mount/fake_collection_dir/.arvados#collection sdk/go/manifest/testdata/*_manifest diff --git a/sdk/cwl/arvados_cwl/runner.py b/sdk/cwl/arvados_cwl/runner.py index 7d4310b0e0..f2517f9199 100644 --- a/sdk/cwl/arvados_cwl/runner.py +++ b/sdk/cwl/arvados_cwl/runner.py @@ -128,6 +128,9 @@ def set_secondary(fsaccess, builder, inputschema, secondaryspec, primary, discov set_secondary(fsaccess, builder, i, secondaryspec, primary, discovered) return + if inputschema == "File": + inputschema = {"type": "File"} + if isinstance(inputschema, basestring): sd = search_schemadef(inputschema, reversed(builder.hints+builder.requirements)) if sd: diff --git a/sdk/cwl/tests/19109-upload-secondary.cwl b/sdk/cwl/tests/19109-upload-secondary.cwl new file mode 100644 index 0000000000..cf5855ab19 --- /dev/null +++ b/sdk/cwl/tests/19109-upload-secondary.cwl @@ -0,0 +1,22 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cwlVersion: v1.2 +class: Workflow +inputs: + file1: + type: File? + secondaryFiles: + - pattern: .tbi + required: true +outputs: + out: + type: File + outputSource: cat/out +steps: + cat: + in: + inp: file1 + run: cat2.cwl + out: [out] diff --git a/sdk/cwl/tests/19109-upload-secondary.yml b/sdk/cwl/tests/19109-upload-secondary.yml new file mode 100644 index 0000000000..c97850019b --- /dev/null +++ b/sdk/cwl/tests/19109-upload-secondary.yml @@ -0,0 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +file1: + class: File + location: 19109-upload-secondary/file1.txt diff --git a/sdk/cwl/tests/19109-upload-secondary/file1.txt b/sdk/cwl/tests/19109-upload-secondary/file1.txt new file mode 100644 index 0000000000..41549dbf8c --- /dev/null +++ b/sdk/cwl/tests/19109-upload-secondary/file1.txt @@ -0,0 +1 @@ +strawberry diff --git a/sdk/cwl/tests/19109-upload-secondary/file1.txt.tbi b/sdk/cwl/tests/19109-upload-secondary/file1.txt.tbi new file mode 100644 index 0000000000..c9438bd232 --- /dev/null +++ b/sdk/cwl/tests/19109-upload-secondary/file1.txt.tbi @@ -0,0 +1 @@ +blueberry \ No newline at end of file diff --git a/sdk/cwl/tests/arvados-tests.yml b/sdk/cwl/tests/arvados-tests.yml index 9e691bdba5..836e667008 100644 --- a/sdk/cwl/tests/arvados-tests.yml +++ b/sdk/cwl/tests/arvados-tests.yml @@ -449,3 +449,16 @@ output: {} tool: 18994-basename/wf_ren.cwl doc: "Test issue 18994 - correctly stage file with modified basename" + +- job: 19109-upload-secondary.yml + output: { + "out": { + "basename": "catted", + "class": "File", + "location": "catted", + "size": 20, + "checksum": "sha1$c4cead17cebdd829f38c48e18a28f1da72339ef7" + } + } + tool: 19109-upload-secondary.cwl + doc: "Test issue 19109 - correctly discover & upload secondary files" diff --git a/sdk/cwl/tests/cat2.cwl b/sdk/cwl/tests/cat2.cwl new file mode 100644 index 0000000000..f8cd57822d --- /dev/null +++ b/sdk/cwl/tests/cat2.cwl @@ -0,0 +1,17 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +cwlVersion: v1.2 +class: CommandLineTool +inputs: + - id: inp + type: File + secondaryFiles: + - pattern: .tbi + required: true +stdout: catted +outputs: + out: + type: stdout +arguments: [cat, '$(inputs.inp.path)', '$(inputs.inp.secondaryFiles[0].path)'] -- 2.30.2