[ARVADOS] updated: 2.1.0-2450-g58241cc5b

Git user git at public.arvados.org
Wed May 11 19:43:00 UTC 2022


Summary of changes:
 sdk/cwl/arvados_cwl/runner.py                      | 19 ++++++++++++++++---
 sdk/cwl/tests/19109-upload-secondary.cwl           | 20 ++++++++++++++++++++
 sdk/cwl/tests/19109-upload-secondary.yml           |  3 +++
 sdk/cwl/tests/19109-upload-secondary/file2.txt     |  1 +
 sdk/cwl/tests/19109-upload-secondary/file2.txt.tbi |  1 +
 5 files changed, 41 insertions(+), 3 deletions(-)
 create mode 100644 sdk/cwl/tests/19109-upload-secondary/file2.txt
 create mode 100644 sdk/cwl/tests/19109-upload-secondary/file2.txt.tbi

       via  58241cc5b82c39270b1d0425a0a1fec4aae8f45e (commit)
      from  66ef73b96e38c87a84ae64bd19385d5d5e9e07ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 58241cc5b82c39270b1d0425a0a1fec4aae8f45e
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Wed May 11 15:42:28 2022 -0400

    19109: test/fix for related bug, finding secondary files with expressions
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/sdk/cwl/arvados_cwl/runner.py b/sdk/cwl/arvados_cwl/runner.py
index f2517f919..995b23c08 100644
--- a/sdk/cwl/arvados_cwl/runner.py
+++ b/sdk/cwl/arvados_cwl/runner.py
@@ -177,9 +177,9 @@ def set_secondary(fsaccess, builder, inputschema, secondaryspec, primary, discov
         primary["secondaryFiles"] = secondaryspec
         for i, sf in enumerate(aslist(secondaryspec)):
             if builder.cwlVersion == "v1.0":
-                pattern = builder.do_eval(sf, context=primary)
+                pattern = sf
             else:
-                pattern = builder.do_eval(sf["pattern"], context=primary)
+                pattern = sf["pattern"]
             if pattern is None:
                 continue
             if isinstance(pattern, list):
@@ -216,7 +216,20 @@ def set_secondary(fsaccess, builder, inputschema, secondaryspec, primary, discov
                     "Expression must return list, object, string or null")
 
             if pattern is not None:
-                sfpath = substitute(primary["location"], pattern)
+                if "${" in pattern or "$(" in pattern:
+                    sfname = builder.do_eval(pattern, context=primary)
+                else:
+                    sfname = substitute(primary["basename"], pattern)
+
+                if sfname is None:
+                    continue
+
+                p_location = primary["location"]
+                if "/" in p_location:
+                    sfpath = (
+                        p_location[0 : p_location.rindex("/") + 1]
+                        + sfname
+                    )
 
             required = builder.do_eval(required, context=primary)
 
diff --git a/sdk/cwl/tests/19109-upload-secondary.cwl b/sdk/cwl/tests/19109-upload-secondary.cwl
index cf5855ab1..933496b6a 100644
--- a/sdk/cwl/tests/19109-upload-secondary.cwl
+++ b/sdk/cwl/tests/19109-upload-secondary.cwl
@@ -4,19 +4,39 @@
 
 cwlVersion: v1.2
 class: Workflow
+
+requirements:
+  InlineJavascriptRequirement: {}
+
 inputs:
   file1:
     type: File?
     secondaryFiles:
       - pattern: .tbi
         required: true
+  file2:
+    type: File
+    secondaryFiles:
+      - pattern: |
+          ${
+          return self.basename + '.tbi';
+          }
+        required: true
 outputs:
   out:
     type: File
     outputSource: cat/out
+  out2:
+    type: File
+    outputSource: cat2/out
 steps:
   cat:
     in:
       inp: file1
     run: cat2.cwl
     out: [out]
+  cat2:
+    in:
+      inp: file2
+    run: cat2.cwl
+    out: [out]
diff --git a/sdk/cwl/tests/19109-upload-secondary.yml b/sdk/cwl/tests/19109-upload-secondary.yml
index c97850019..af4147ae9 100644
--- a/sdk/cwl/tests/19109-upload-secondary.yml
+++ b/sdk/cwl/tests/19109-upload-secondary.yml
@@ -5,3 +5,6 @@
 file1:
   class: File
   location: 19109-upload-secondary/file1.txt
+file2:
+  class: File
+  location: 19109-upload-secondary/file2.txt
diff --git a/sdk/cwl/tests/19109-upload-secondary/file2.txt b/sdk/cwl/tests/19109-upload-secondary/file2.txt
new file mode 100644
index 000000000..637a09b86
--- /dev/null
+++ b/sdk/cwl/tests/19109-upload-secondary/file2.txt
@@ -0,0 +1 @@
+banana
diff --git a/sdk/cwl/tests/19109-upload-secondary/file2.txt.tbi b/sdk/cwl/tests/19109-upload-secondary/file2.txt.tbi
new file mode 100644
index 000000000..4d5e62525
--- /dev/null
+++ b/sdk/cwl/tests/19109-upload-secondary/file2.txt.tbi
@@ -0,0 +1 @@
+mango
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list