Skip to content

Commit d1105e7

Browse files
author
Peter Amstutz
authored
If document has an id: field, use it. (#1141)
* If document has an id: field, use it. From resolve_and_validate return uri with the added id fragment and use it downstream to reference the document.
1 parent 62ae257 commit d1105e7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cwltool/load_tool.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ def resolve_and_validate_document(loadingContext,
291291
if not isinstance(metadata, CommentedMap):
292292
raise ValidationException("metadata must be a CommentedMap, was %s" % type(metadata))
293293

294+
if isinstance(processobj, CommentedMap):
295+
uri = processobj["id"]
296+
294297
_convert_stdstreams_to_files(workflowobj)
295298

296299
if preprocess_only:

tests/test_pack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def _pack_idempotently(document):
108108
loadingContext.do_update = False
109109
loadingContext, uri2 = resolve_and_validate_document(
110110
loadingContext, workflowobj, uri)
111-
processobj = loadingContext.loader.resolve_ref(uri)[0]
111+
processobj = loadingContext.loader.resolve_ref(uri2)[0]
112112
double_packed = json.loads(print_pack(loadingContext.loader, processobj, uri2, loadingContext.metadata))
113113
assert packed == double_packed
114114

0 commit comments

Comments
 (0)