Skip to content

Commit

Permalink
updating docker tests; fixing issue with working directory for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
djarecka committed Feb 27, 2023
1 parent eb049eb commit bab281c
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 698 deletions.
5 changes: 4 additions & 1 deletion pydra/engine/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ def execute(self, task, root="/mnt/pydra"):
# todo adding xargsy etc
docker_args = ["docker", "run", "-v", self.bind(task.cache_dir, "rw")]
docker_args.extend(
" ".join([f"-v {self.bind(mount)}" for mount in mounts]).split()
" ".join(
[f"-v {key}:{val[0]}:{val[1]}" for (key, val) in mounts.items()]
).split()
)
docker_args.extend(["-w", f"{root}{task.output_dir}"])
keys = ["return_code", "stdout", "stderr"]
# print("\n Docker args", docker_args)

Expand Down
8 changes: 6 additions & 2 deletions pydra/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def get_inputs_in_root(self, root=None):
return []
else:
self._check_inputs(root=root)
return self.bindings.keys()
return self.bindings

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

0 comments on commit bab281c

Please sign in to comment.