19280: explicitly include/exclude primary
[arvados.git] / sdk / cwl / arvados_cwl / runner.py
index d2486c164bec6e85176a416c45e50964deea8e6d..d2dfcf26bc0e9c8b2b1c98e12f339597ecd5f256 100644 (file)
@@ -417,8 +417,14 @@ def upload_dependencies(arvrunner, name, document_loader,
 
     normalizeFilesDirs(sc)
 
-    if include_primary and "id" in workflowobj:
-        sc.append({"class": "File", "location": workflowobj["id"]})
+    if "id" in workflowobj:
+        defrg, _ = urllib.parse.urldefrag(workflowobj["id"])
+        if include_primary:
+            # make sure it's included
+            sc.append({"class": "File", "location": defrg})
+        else:
+            # make sure it's excluded
+            sc = [d for d in sc if d.get("location") != defrg]
 
     def visit_default(obj):
         def defaults_are_optional(f):