16377: Fix CollectionFsAccess.exists to catch IOError & return False
authorPeter Amstutz <peter.amstutz@curii.com>
Thu, 25 Jun 2020 21:36:19 +0000 (17:36 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 14 Jul 2020 17:50:16 +0000 (13:50 -0400)
Add test to reproduce

Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

sdk/cwl/arvados_cwl/fsaccess.py
sdk/cwl/tests/13976-keepref-wf.cwl
sdk/cwl/tests/16377-missing-default.cwl [new file with mode: 0644]
sdk/cwl/tests/arvados-tests.yml
sdk/cwl/tests/hello.yml [new file with mode: 0644]

index bc2c5e34d7b6c2737cc8bdcb541fc1daf394d9ae..4688e65a3748348b8068bd27e1d9e78aa5a5e9de 100644 (file)
@@ -148,6 +148,11 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
                 return False
             else:
                 raise
+        except IOError as err:
+            if err.errno == errno.ENOENT:
+                return False
+            else:
+                raise
         if collection is not None:
             if rest:
                 return collection.exists(rest)
index 7aa7b0aa43c06a0ae6e2d6615541de0cf428f94a..8d0dee971a89901c216e1223870662e49eb7a7e0 100644 (file)
@@ -1,11 +1,18 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
 cwlVersion: v1.0
 class: CommandLineTool
 requirements:
   - class: InlineJavascriptRequirement
+  - class: ShellCommandRequirement
 arguments:
+  - cd
+  - $(inputs.hello.dirname)
+  - {shellQuote: false, valueFrom: "&&"}
   - ls
-  - -l
-  - $(inputs.hello)
+stdout: hello.out
 inputs:
   hello:
     type: File
@@ -14,4 +21,8 @@ inputs:
       location: keep:4d8a70b1e63b2aad6984e40e338e2373+69/hello.txt
     secondaryFiles:
       - .idx
-outputs: []
\ No newline at end of file
+outputs:
+  out:
+    type: File
+    outputBinding:
+      glob: hello.out
diff --git a/sdk/cwl/tests/16377-missing-default.cwl b/sdk/cwl/tests/16377-missing-default.cwl
new file mode 100644 (file)
index 0000000..b8208e6
--- /dev/null
@@ -0,0 +1,28 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cwlVersion: v1.0
+class: CommandLineTool
+requirements:
+  - class: InlineJavascriptRequirement
+  - class: ShellCommandRequirement
+arguments:
+  - cd
+  - $(inputs.hello.dirname)
+  - {shellQuote: false, valueFrom: "&&"}
+  - ls
+stdout: hello.out
+inputs:
+  hello:
+    type: File
+    default:
+      class: File
+      location: keep:ffffffffffffffffffffffffffaaaaaa+69/hello.txt
+    secondaryFiles:
+      - .idx
+outputs:
+  out:
+    type: File
+    outputBinding:
+      glob: hello.out
index c4c0968756a46b04ad8b201cbc66241fb4d6826d..a46decd9616cff63fe932e2320568b14c563b3b6 100644 (file)
 
 - job: null
   output:
-    out: null
+    "out": {
+        "location": "hello.out",
+        "class": "File",
+        "checksum": "sha1$ec5d3976351abab45a483a49ce714a8430cb203a",
+        "size": 24
+    }
   tool: 13976-keepref-wf.cwl
   doc: "Test issue 13976"
 
   }
   tool: 16169-no-listing-hint.cwl
   doc: "Test cwltool:LoadListingRequirement propagation"
+
+- job: hello.yml
+  output:
+    "out": {
+        "location": "hello.out",
+        "class": "File",
+        "checksum": "sha1$ec5d3976351abab45a483a49ce714a8430cb203a",
+        "size": 24
+    }
+  tool: 16377-missing-default.cwl
+  doc: "Test issue 16377 - missing default fails even when it should be overridden by valid input"
diff --git a/sdk/cwl/tests/hello.yml b/sdk/cwl/tests/hello.yml
new file mode 100644 (file)
index 0000000..e7a324e
--- /dev/null
@@ -0,0 +1,7 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+hello:
+  class: File
+  location: keep:4d8a70b1e63b2aad6984e40e338e2373+69/hello.txt