From ee72aa108e0cdfbf62db9c9114ebca9616ec42b3 Mon Sep 17 00:00:00 2001 From: Vasu Jaganath Date: Wed, 9 Oct 2024 14:03:20 -0400 Subject: [PATCH 1/2] add user args for workflows built with python api --- src/sophios/api/pythonapi.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sophios/api/pythonapi.py b/src/sophios/api/pythonapi.py index a5984c5f..195ba7e1 100644 --- a/src/sophios/api/pythonapi.py +++ b/src/sophios/api/pythonapi.py @@ -489,6 +489,7 @@ class Workflow(BaseModel): steps: list # list[Process] # and cannot use Process defined after Workflow within a Workflow process_name: str + user_args: list[str] inputs: list[ProcessInput] = [] outputs: list[ProcessOutput] = [] _input_names: list[str] = PrivateAttr(default_factory=list) @@ -499,10 +500,11 @@ class Workflow(BaseModel): # field(default=None, init=False, repr=False) # TypeError: 'ModelPrivateAttr' object is not iterable - def __init__(self, steps: list, workflow_name: str): + def __init__(self, steps: list, workflow_name: str, user_args: list[str] = []): data = { "process_name": workflow_name, "steps": steps, + "user_args": user_args } super().__init__(**data) @@ -725,7 +727,7 @@ def compile(self, write_to_disk: bool = False) -> CompilerInfo: """ global global_config self._validate() - args = get_args(self.process_name) # Use mock CLI args + args = get_args(self.process_name, self.user_args) # Use mock CLI args graph = get_graph_reps(self.process_name) yaml_tree = YamlTree(StepId(self.process_name, 'global'), self.yaml) @@ -751,7 +753,7 @@ def run(self) -> None: plugins.logging_filters() compiler_info = self.compile(write_to_disk=True) - args = get_args(self.process_name) # Use mock CLI args + args = get_args(self.process_name, self.user_args) # Use mock CLI args rose_tree: RoseTree = compiler_info.rose # cwl-docker-extract recursively `docker pull`s all images in all subworkflows. From 846cec8534f57fb7c703e1c5d2ea6b152e513f25 Mon Sep 17 00:00:00 2001 From: Vasu Jaganath Date: Wed, 16 Oct 2024 07:36:49 -0400 Subject: [PATCH 2/2] remove redundant io in main & remove irrelevant warning/exit in compiler --- src/sophios/compiler.py | 4 ---- src/sophios/main.py | 3 --- 2 files changed, 7 deletions(-) diff --git a/src/sophios/compiler.py b/src/sophios/compiler.py index 353c7837..e81e843b 100644 --- a/src/sophios/compiler.py +++ b/src/sophios/compiler.py @@ -881,10 +881,6 @@ def compile_workflow_once(yaml_tree_ast: YamlTree, new_keyval = {key: newval} elif 'Directory' == in_dict['type']: if not args.ignore_dir_path: - if in_dict['value'].startswith('/'): - print("Warning! directory can not start with '/'") - print("It is most likely an incorrect path! Can't create directories!") - sys.exit(1) ldir = Path(in_dict['value']) if not ldir.is_absolute(): ldir = Path('autogenerated') / ldir diff --git a/src/sophios/main.py b/src/sophios/main.py index 24a6dbdd..73838fc2 100644 --- a/src/sophios/main.py +++ b/src/sophios/main.py @@ -194,9 +194,6 @@ def main() -> None: print("(This may happen if you installed the graphviz python package") print("but not the graphviz system package.)") - if args.generate_cwl_workflow: - io.write_to_disk(rose_tree, Path('autogenerated/'), True, args.inputs_file) - if args.run_local or args.generate_run_script: # cwl-docker-extract recursively `docker pull`s all images in all subworkflows. # This is important because cwltool only uses `docker run` when executing