Skip to content

Commit dda97d7

Browse files
authored
Bump ruamel.yaml + fix handling overrides in job order (#974)
* Bump ruamel.yaml + fix handling overrides in job order * Passes with (but does not require) latest schema-salad
1 parent 23b93e4 commit dda97d7

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

cwltool/builder.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,13 @@ def bind_input(self,
192192
binding = CommentedMap(schema["inputBinding"].items())
193193
assert binding is not None
194194

195+
bp = list(aslist(lead_pos))
195196
if "position" in binding:
196-
binding["position"] = aslist(lead_pos) + aslist(binding["position"]) + aslist(tail_pos)
197+
bp.extend(aslist(binding["position"]))
197198
else:
198-
binding["position"] = aslist(lead_pos) + [0] + aslist(tail_pos)
199+
bp.append(0)
200+
bp.extend(aslist(tail_pos))
201+
binding["position"] = bp
199202

200203
binding["datum"] = datum
201204
if "valueFrom" in binding:

cwltool/load_tool.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
overrides_ctx = {
4949
u"overrideTarget": {u"@type": u"@id"},
5050
u"cwltool": "http://commonwl.org/cwltool#",
51-
u"overrides": {
51+
u"http://commonwl.org/cwltool#overrides": {
5252
"@id": "cwltool:overrides",
5353
"mapSubject": "overrideTarget",
5454
},
@@ -226,7 +226,7 @@ def validate_document(document_loader, # type: Loader
226226
uri = urllib.parse.urljoin(uri, workflowobj["https://w3id.org/cwl/cwl#tool"])
227227
del cast(dict, jobobj)["https://w3id.org/cwl/cwl#tool"]
228228

229-
if "http://commonwl.org/cwltool#overrides" in jobobj:
229+
if isinstance(jobobj, CommentedMap) and "http://commonwl.org/cwltool#overrides" in jobobj:
230230
overrides.extend(resolve_overrides(jobobj, uri, uri))
231231
del jobobj["http://commonwl.org/cwltool#overrides"]
232232

@@ -272,7 +272,7 @@ def validate_document(document_loader, # type: Loader
272272
if isinstance(avsc_names, Exception):
273273
raise avsc_names
274274

275-
processobj = None # type: Union[CommentedMap, CommentedSeq, Text]
275+
processobj = None # type: Union[CommentedMap, CommentedSeq, Text, None]
276276
document_loader = Loader(sch_document_loader.ctx, schemagraph=sch_document_loader.graph,
277277
idx=document_loader.idx, cache=sch_document_loader.cache,
278278
fetcher_constructor=fetcher_constructor, skip_schemas=skip_schemas)
@@ -285,7 +285,7 @@ def validate_document(document_loader, # type: Loader
285285
if not isinstance(processobj, (CommentedMap, CommentedSeq)):
286286
raise ValidationException("Workflow must be a dict or list.")
287287

288-
if not new_metadata:
288+
if not new_metadata and isinstance(processobj, CommentedMap):
289289
new_metadata = cast(CommentedMap, cmap(
290290
{"$namespaces": processobj.get("$namespaces", {}),
291291
"$schemas": processobj.get("$schemas", []),
@@ -387,7 +387,7 @@ def resolve_overrides(ov, # Type: CommentedMap
387387
raise Exception("Expected CommentedMap, got %s" % type(ret))
388388
cwl_docloader = get_schema("v1.0")[0]
389389
cwl_docloader.resolve_all(ret, ov_uri)
390-
return ret["overrides"]
390+
return ret["http://commonwl.org/cwltool#overrides"]
391391

392392
def load_overrides(ov, base_url): # type: (Text, Text) -> List[Dict[Text, Any]]
393393
ovloader = Loader(overrides_ctx)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
requests>=2.4.3
2-
ruamel.yaml>=0.12.4,<=0.15.51
2+
ruamel.yaml>=0.12.4,<=0.15.77
33
rdflib>=4.2.2,<4.3
44
shellescape>=3.4.1,<3.5
55
schema-salad>=2.7.20180905124720,<3

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
'setuptools',
5050
'requests >= 2.6.1', # >= 2.6.1 to workaround
5151
# https://github.com/ionrock/cachecontrol/issues/137
52-
'ruamel.yaml >= 0.12.4, <= 0.15.51',
52+
'ruamel.yaml >= 0.12.4, <= 0.15.77',
5353
'rdflib >= 4.2.2, < 4.3.0',
5454
'shellescape >= 3.4.1, < 3.5',
5555
'schema-salad >= 2.7.20180905124720, < 3',

0 commit comments

Comments
 (0)