Skip to content

Commit 0932350

Browse files
authored
Bugfixs: pathmap on "Any" type, don't crash subgraph when inport has no source (#966)
* Bugfix: should apply to pathmapper to files in "Any" inputs * Fix subgraph, don't crash when inport doesn't have a source.
1 parent c804c0d commit 0932350

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

cwltool/builder.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ def bind_input(self,
264264
self.bind_input(itemschema, item, lead_pos=n, tail_pos=tail_pos, discover_secondaryFiles=discover_secondaryFiles))
265265
binding = None
266266

267+
def _capture_files(f):
268+
self.files.append(f)
269+
return f
270+
267271
if schema["type"] == "File":
268272
self.files.append(datum)
269273
if (binding and binding.get("loadContents")) or schema.get("loadContents"):
@@ -308,10 +312,6 @@ def bind_input(self,
308312
"Expected value of '%s' to have format %s but\n "
309313
" %s" % (schema["name"], schema["format"], ve))
310314

311-
def _capture_files(f):
312-
self.files.append(f)
313-
return f
314-
315315
visit_class(datum.get("secondaryFiles", []), ("File", "Directory"), _capture_files)
316316

317317
if schema["type"] == "Directory":
@@ -320,6 +320,9 @@ def _capture_files(f):
320320
get_listing(self.fs_access, datum, (ll == "deep_listing"))
321321
self.files.append(datum)
322322

323+
if schema["type"] == "Any":
324+
visit_class(datum, ("File", "Directory"), _capture_files)
325+
323326
# Position to front of the sort key
324327
if binding is not None:
325328
for bi in bindings:

cwltool/subgraph.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ def find_step(stepid): # type: (Text) -> Optional[MutableMapping]
128128
if i["id"] in visited:
129129
if f == "steps":
130130
for inport in i["in"]:
131+
if "source" not in inport:
132+
continue
131133
if isinstance(inport["source"], MutableSequence):
132134
inport["source"] = [rewire[s][0] for s in inport["source"] if s in rewire]
133135
elif inport["source"] in rewire:

0 commit comments

Comments
 (0)