Skip to content

Commit 7682370

Browse files
author
Peter Amstutz
committed
Bugfix reloading packed workflows, use loadingContext metadata to establish version
1 parent b420246 commit 7682370

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

cwltool/load_tool.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,16 @@ def resolve_and_validate_document(loadingContext,
216216

217217
fileuri = urllib.parse.urldefrag(uri)[0]
218218

219-
cwlVersion = workflowobj.get("cwlVersion")
219+
cwlVersion = loadingContext.metadata.get("cwlVersion")
220220
if not cwlVersion:
221-
fileobj = fetch_document(fileuri, loadingContext)[1]
222-
cwlVersion = fileobj.get("cwlVersion")
223-
if not cwlVersion:
224-
raise ValidationException(
225-
"No cwlVersion found. "
226-
"Use the following syntax in your CWL document to declare "
227-
"the version: cwlVersion: <version>.\n"
228-
"Note: if this is a CWL draft-2 (pre v1.0) document then it "
229-
"will need to be upgraded first.")
221+
cwlVersion = workflowobj.get("cwlVersion")
222+
if not cwlVersion:
223+
raise ValidationException(
224+
"No cwlVersion found. "
225+
"Use the following syntax in your CWL document to declare "
226+
"the version: cwlVersion: <version>.\n"
227+
"Note: if this is a CWL draft-2 (pre v1.0) document then it "
228+
"will need to be upgraded first.")
230229

231230
if not isinstance(cwlVersion, string_types):
232231
with SourceLine(workflowobj, "cwlVersion", ValidationException):
@@ -285,6 +284,8 @@ def resolve_and_validate_document(loadingContext,
285284
workflowobj["id"] = fileuri
286285
processobj, metadata = document_loader.resolve_all(
287286
workflowobj, fileuri, checklinks=loadingContext.do_validate)
287+
if loadingContext.metadata:
288+
metadata = loadingContext.metadata
288289
if not isinstance(processobj, (CommentedMap, CommentedSeq)):
289290
raise ValidationException("Workflow must be a CommentedMap or CommentedSeq.")
290291
if not isinstance(metadata, CommentedMap):

cwltool/update.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def checkversion(doc, # type: Union[CommentedSeq, CommentedMap]
122122
else:
123123
raise Exception("Expected CommentedMap or CommentedSeq")
124124

125-
version = cdoc[u"cwlVersion"]
125+
version = metadata[u"cwlVersion"]
126+
cdoc["cwlVersion"] = version
126127

127128
if version not in UPDATES:
128129
if version in DEVUPDATES:

0 commit comments

Comments
 (0)