Skip to content

Commit b1fd37d

Browse files
committed
Ensure full mapping of paths to container
The step in `CommandLineTool.job` that implicitly maps files in builder.bindings to container paths via dictionary assignment misses some cases in complex inputs. The result is that builder.bindings will have correct internal Docker paths in `valueFrom` but not in `do_eval`, leading to command line arguments that still reference the external path. To fix, this does an explicit `adjustFiles` remapping over all elements in builder.bindings, supplementing the work done by the implicit call and ensuring both `builder.files` and `builder.bindings` are synchronized. Thanks to @tetron for discussion and pointers on digging into the code to fix this.
1 parent 214501a commit b1fd37d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cwltool/draft2tool.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,16 @@ def job(self, joborder, input_basedir, output_callback, **kwargs):
149149
builder.pathmapper = self.makePathMapper(reffiles, input_basedir, **kwargs)
150150
builder.requirements = j.requirements
151151

152+
# map files to assigned path inside a container. We need to also explicitly
153+
# walk over input as implicit reassignment doesn't reach everything in builder.bindings
152154
for f in builder.files:
153155
f["path"] = builder.pathmapper.mapper(f["path"])[1]
156+
def _check_adjust(f):
157+
try:
158+
return builder.pathmapper.mapper(f)[1]
159+
except KeyError:
160+
return f
161+
adjustFiles(builder.bindings, _check_adjust)
154162

155163
_logger.debug("[job %s] command line bindings is %s", j.name, json.dumps(builder.bindings, indent=4))
156164
_logger.debug("[job %s] path mappings is %s", j.name, json.dumps({p: builder.pathmapper.mapper(p) for p in builder.pathmapper.files()}, indent=4))

0 commit comments

Comments
 (0)