Skip to content

Commit 7719daf

Browse files
vjaganat90Vasu Jaganath
andauthored
add user args for workflows built with python api (PolusAI#283)
Co-authored-by: Vasu Jaganath <[email protected]>
1 parent 11705e1 commit 7719daf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/sophios/api/pythonapi.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ class Workflow(BaseModel):
489489

490490
steps: list # list[Process] # and cannot use Process defined after Workflow within a Workflow
491491
process_name: str
492+
user_args: list[str]
492493
inputs: list[ProcessInput] = []
493494
outputs: list[ProcessOutput] = []
494495
_input_names: list[str] = PrivateAttr(default_factory=list)
@@ -499,10 +500,11 @@ class Workflow(BaseModel):
499500
# field(default=None, init=False, repr=False)
500501
# TypeError: 'ModelPrivateAttr' object is not iterable
501502

502-
def __init__(self, steps: list, workflow_name: str):
503+
def __init__(self, steps: list, workflow_name: str, user_args: list[str] = []):
503504
data = {
504505
"process_name": workflow_name,
505506
"steps": steps,
507+
"user_args": user_args
506508
}
507509
super().__init__(**data)
508510

@@ -725,7 +727,7 @@ def compile(self, write_to_disk: bool = False) -> CompilerInfo:
725727
"""
726728
global global_config
727729
self._validate()
728-
args = get_args(self.process_name) # Use mock CLI args
730+
args = get_args(self.process_name, self.user_args) # Use mock CLI args
729731

730732
graph = get_graph_reps(self.process_name)
731733
yaml_tree = YamlTree(StepId(self.process_name, 'global'), self.yaml)
@@ -751,7 +753,7 @@ def run(self) -> None:
751753
plugins.logging_filters()
752754
compiler_info = self.compile(write_to_disk=True)
753755

754-
args = get_args(self.process_name) # Use mock CLI args
756+
args = get_args(self.process_name, self.user_args) # Use mock CLI args
755757
rose_tree: RoseTree = compiler_info.rose
756758

757759
# cwl-docker-extract recursively `docker pull`s all images in all subworkflows.

0 commit comments

Comments
 (0)