Restore check for 'id' field for CWL v1.0 only
authorPeter Amstutz <peter.amstutz@curii.com>
Mon, 29 Jun 2020 18:55:55 +0000 (14:55 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Mon, 29 Jun 2020 18:55:55 +0000 (14:55 -0400)
On further research, I realized why the check for 'id' on embedded
process objects was in place (to catch potential id conflicts earlier
instead of later), however the underlying problem is resolved in cwl
1.1+

refs #16382

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

sdk/cwl/arvados_cwl/runner.py
sdk/cwl/tests/arvados-tests.yml
sdk/cwl/tests/wf-defaults/default-dir4.cwl
sdk/cwl/tests/wf-defaults/default-dir8.cwl [new file with mode: 0644]
sdk/cwl/tests/wf-defaults/wf4.cwl
sdk/cwl/tests/wf-defaults/wf8.cwl [new file with mode: 0644]

index a47b34acc0b31d304e56f98d89a6d277e598c9ea..71e499ebcab0cca29ccbee7a350cfbbb5aaa6e19 100644 (file)
@@ -460,6 +460,8 @@ def packed_workflow(arvrunner, tool, merged_map):
     def visit(v, cur_id):
         if isinstance(v, dict):
             if v.get("class") in ("CommandLineTool", "Workflow"):
+                if tool.metadata["cwlVersion"] == "v1.0" and "id" not in v:
+                    raise SourceLine(v, None, Exception).makeError("Embedded process object is missing required 'id' field, add an 'id' or use to cwlVersion: v1.1")
                 if "id" in v:
                     cur_id = rewrite_to_orig.get(v["id"], v["id"])
             if "path" in v and "location" not in v:
index 786dc643ca611be49b71db2136382b4781cc107b..c4c0968756a46b04ad8b201cbc66241fb4d6826d 100644 (file)
   output:
     out: null
   tool: wf-defaults/wf4.cwl
-  doc: default in embedded subworkflow missing 'id' field
+  doc: default in embedded subworkflow missing 'id' field, v1.0
+  should_fail: true
+
+- job: null
+  output:
+    out: null
+  tool: wf-defaults/wf8.cwl
+  doc: default in embedded subworkflow missing 'id' field, v1.1
   should_fail: false
 
 - job: null
index a5b9c2f3ec071bad1f83d52a89edda538fdda704..bd927824886d1805cf8daf260e4911e6b4fe2d85 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-cwlVersion: v1.1
+cwlVersion: v1.0
 class: Workflow
 inputs: []
 outputs: []
diff --git a/sdk/cwl/tests/wf-defaults/default-dir8.cwl b/sdk/cwl/tests/wf-defaults/default-dir8.cwl
new file mode 100644 (file)
index 0000000..a5b9c2f
--- /dev/null
@@ -0,0 +1,24 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cwlVersion: v1.1
+class: Workflow
+inputs: []
+outputs: []
+$namespaces:
+  arv: "http://arvados.org/cwl#"
+steps:
+  step1:
+    in: []
+    out: []
+    run:
+      class: CommandLineTool
+      inputs:
+        inp2:
+          type: Directory
+          default:
+            class: Directory
+            location: inp1
+      outputs: []
+      arguments: [echo, $(inputs.inp2)]
index 27abea290cbb199ae125247688e04df15a20bb2b..3f498fdffbfa56100c721f6efb78efcb40267f74 100644 (file)
@@ -2,7 +2,7 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-cwlVersion: v1.1
+cwlVersion: v1.0
 class: Workflow
 inputs: []
 outputs: []
diff --git a/sdk/cwl/tests/wf-defaults/wf8.cwl b/sdk/cwl/tests/wf-defaults/wf8.cwl
new file mode 100644 (file)
index 0000000..2548fae
--- /dev/null
@@ -0,0 +1,17 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+cwlVersion: v1.1
+class: Workflow
+inputs: []
+outputs: []
+$namespaces:
+  arv: "http://arvados.org/cwl#"
+requirements:
+  SubworkflowFeatureRequirement: {}
+steps:
+  step1:
+    in: []
+    out: []
+    run: default-dir8.cwl