Skip to content

Commit 92bc8c3

Browse files
authored
Merge pull request #520 from djarecka/rf/shell_cmdline
simplifying ShellCommandTask.cmdline
2 parents 0520af5 + 90c518d commit 92bc8c3

File tree

10 files changed

+161
-244
lines changed

10 files changed

+161
-244
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: check-yaml
1010
- id: check-added-large-files
1111
- repo: https://github.com/psf/black
12-
rev: 22.1.0
12+
rev: 22.3.0
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/codespell-project/codespell

pydra/engine/specs.py

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ def check_fields_input_spec(self):
187187
or "pydra.engine.specs.File" in str(fld.type)
188188
or "pydra.engine.specs.Directory" in str(fld.type)
189189
):
190-
self._file_check_n_bindings(fld)
190+
self._file_check(fld)
191191

192192
for nm, required in require_to_check.items():
193193
required_notfound = [el for el in required if el not in names]
194194
if required_notfound:
195195
raise AttributeError(f"{nm} requires {required_notfound}")
196196

197-
def _file_check_n_bindings(self, field):
198-
"""for tasks without container, this is simple check if the file exists"""
197+
def _file_check(self, field):
198+
"""checking if the file exists"""
199199
if isinstance(getattr(self, field.name), list):
200200
# if value is a list and type is a list of Files/Directory, checking all elements
201201
if field.type in [ty.List[File], ty.List[Directory]]:
@@ -682,39 +682,6 @@ class ContainerSpec(ShellSpec):
682682
container_xargs: ty.Optional[ty.List[str]] = attr.ib(
683683
default=None, metadata={"help_string": "todo"}
684684
)
685-
"""Execution arguments to run the image."""
686-
bindings: ty.Optional[
687-
ty.List[
688-
ty.Tuple[
689-
Path, # local path
690-
Path, # container path
691-
ty.Optional[str], # mount mode
692-
]
693-
]
694-
] = attr.ib(default=None, metadata={"help_string": "bindings"})
695-
"""Mount points to be bound into the container."""
696-
697-
def _file_check_n_bindings(self, field):
698-
if field.name == "image":
699-
return
700-
file = Path(getattr(self, field.name))
701-
if field.metadata.get("container_path"):
702-
# if the path is in a container the input should be treated as a str (hash as a str)
703-
# field.type = "str"
704-
# setattr(self, field.name, str(file))
705-
pass
706-
# if this is a local path, checking if the path exists
707-
elif file.exists():
708-
if self.bindings is None:
709-
self.bindings = []
710-
self.bindings.append((file.parent, f"/pydra_inp_{field.name}", "ro"))
711-
# error should be raised only if the type is strictly File or Directory
712-
elif field.type in [File, Directory]:
713-
raise FileNotFoundError(
714-
f"the file {file} from {field.name} input does not exist, "
715-
f"if the file comes from the container, "
716-
f"use field.metadata['container_path']=True"
717-
)
718685

719686

720687
@attr.s(auto_attribs=True, kw_only=True)

0 commit comments

Comments
 (0)