Skip to content

Commit

Permalink
add user args for workflows built with python api
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasu Jaganath committed Oct 16, 2024
1 parent 11705e1 commit ee72aa1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sophios/api/pythonapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand Down

0 comments on commit ee72aa1

Please sign in to comment.