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

Skip to content

Commit bab281c

Browse files
committed
updating docker tests; fixing issue with working directory for docker
1 parent eb049eb commit bab281c

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
@@ -345,7 +345,7 @@ def get_inputs_in_root(self, root=None):
345345
return []
346346
else:
347347
self._check_inputs(root=root)
348-
return self.bindings.keys()
348+
return self.bindings
349349

350350
def command_args(self, root=None):
351351
"""Get command line arguments"""
@@ -609,9 +609,13 @@ def _check_inputs(self, root):
609609
# TODO: what if it's a directory? add tests
610610
elif file.exists(): # is it ok if two inputs have the same parent?
611611
# todo: probably need only keys
612+
if fld.metadata.get("mandatory"):
613+
mod = "rw"
614+
else:
615+
mod = "ro"
612616
self.bindings[Path(file.parent)] = (
613617
Path(f"{root}{file.parent}"),
614-
"ro",
618+
mod,
615619
)
616620
self.inputs_mod_root[fld.name] = f"{root}{Path(file).absolute()}"
617621
# error should be raised only if the type is strictly File or Directory

0 commit comments

Comments
 (0)
0