Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user args for workflows built with python api #283

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading