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

remove redundant io in main & remove irrelevant warning/exit in compiler #284

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 0 additions & 4 deletions src/sophios/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/sophios/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading