Skip to content

Commit ffa747e

Browse files
author
Peter Amstutz
committed
Support uri fragments in cwl:tool field of job objects, fix typo in previous commit.
1 parent 6ef6f72 commit ffa747e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

cwltool/main.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,24 +283,26 @@ def load_tool(argsworkflow, updateonly, strict, makeTool, debug,
283283
uri = "file://" + os.path.abspath(argsworkflow)
284284
fileuri, urifrag = urlparse.urldefrag(uri)
285285
workflowobj = document_loader.fetch(fileuri)
286-
if isinstance(workflowobj, list):
287-
# bare list without a version must be treated as draft-2
288-
workflowobj = {"cwlVersion": "https://w3id.org/cwl/cwl#draft-2",
289-
"id": fileuri,
290-
"@graph": workflowobj}
291286
elif isinstance(argsworkflow, dict):
292287
workflowobj = argsworkflow
293288
uri = urifrag
294-
fileuri = ""
289+
fileuri = "#"
295290
else:
296291
raise schema_salad.validate.ValidationException("Must be URI or dict")
297292

298293
if "cwl:tool" in workflowobj:
299294
jobobj = workflowobj
300-
workflowobj = document_loader.fetch(urlparse.urljoin(uri, workflowobj["cwl:tool"]))
301-
_, urifrag = urlparse.urldefrag(workflowobj["cwl:tool"])
295+
uri = urlparse.urljoin(uri, jobobj["cwl:tool"])
296+
fileuri, urifrag = urlparse.urldefrag(uri)
297+
workflowobj = document_loader.fetch(fileuri)
302298
del jobobj["cwl:tool"]
303299

300+
if isinstance(workflowobj, list):
301+
# bare list without a version must be treated as draft-2
302+
workflowobj = {"cwlVersion": "https://w3id.org/cwl/cwl#draft-2",
303+
"id": fileuri,
304+
"@graph": workflowobj}
305+
304306
workflowobj = update.update(workflowobj, document_loader, fileuri)
305307
document_loader.idx.clear()
306308

0 commit comments

Comments
 (0)