8000 updating docker tests; fixing issue with working directory for docker · nipype/pydra@493071d · GitHub
[go: up one dir, main page]

Skip to content

Commit 493071d

Browse files
committed
updating docker tests; fixing issue with working directory for docker
1 parent 016fc4c commit 493071d

File tree

3 files changed

+267
-698
lines changed

3 files changed

+267
-698
lines changed

pydra/engine/environments.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@ def execute(self, task, root="/mnt/pydra"):
6060
# todo adding xargsy etc
6161
docker_args = ["docker", "run", "-v", self.bind(task.cache_dir, "rw")]
6262
docker_args.extend(
63-
" ".join([f"-v {self.bind(mount)}" for mount in mounts]).split()
63+
" ".join(
64+
[f"-v {key}:{val[0]}:{val[1]}" for (key, val) in mounts.items()]
65+
).split()
6466
)
67+
docker_args.extend(["-w", f"{root}{task.output_dir}"])
6568
keys = ["return_code", "stdout", "stderr"]
6669
# print("\n Docker args", docker_args)
6770

pydra/engine/task.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def get_inputs_in_root(self, root=None):
343343
return []
344344
else:
345345
self._check_inputs(root=root)
346-
return self.bindings.keys()
346+
return self.bindings
347347

348348
def command_args(self, root=None):
349349
"""Get command line arguments"""
@@ -601,9 +601,13 @@ def _check_inputs(self, root):
601601
# TODO: what if it's a directory? add tests
602602
elif file.exists(): # is it ok if two inputs have the same parent?
603603
# todo: probably need only keys
604+
if fld.metadata.get("mandatory"):
605+
mod = "rw"
606+
else:
607+
mod = "ro"
604608
self.bindings[Path(file.parent)] = (
605609
Path(f"{root}{file.parent}"),
606-
"ro",
610+
mod,
607611
)
608612
self.inputs_mod_root[fld.name] = f"{root}{Path(file).absolute()}"
609613
# error should be raised only if the type is strictly File or Directory

0 commit comments

Comments
 (0)
0