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 flag to only compile workflow to cwl without running #272

Merged
merged 5 commits into from
Oct 3, 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
1 change: 0 additions & 1 deletion src/sophios/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
help='After generating the cwl file(s), run it on your local machine.')
group_run.add_argument('--generate_cwl_workflow', required=False, default=False, action="store_true",
help='Compile the workflow without pulling the docker image')

parser.add_argument('--cwl_inline_subworkflows', default=False, action="store_true",
help='Before generating the cwl file, inline all subworkflows.')
parser.add_argument('--inference_disable', default=False, action="store_true",
Expand Down
24 changes: 24 additions & 0 deletions tests/data/cwl/helloworld.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env cwl-runner
# This file was autogenerated using the Workflow Inference Compiler, version 0+unknown
# https://github.com/PolusAI/workflow-inference-compiler
steps:
- id: helloworld__step__1__echo
in:
message:
source: helloworld__step__1__echo___message
run: helloworld__step__1__echo/echo.cwl
out:
- stdout
cwlVersion: v1.2
class: Workflow
$namespaces:
edam: https://edamontology.org/
$schemas:
- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl
inputs:
helloworld__step__1__echo___message:
type: string
outputs:
helloworld__step__1__echo___stdout:
type: File
outputSource: helloworld__step__1__echo/stdout
35 changes: 35 additions & 0 deletions tests/test_cli_flags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import pathlib
import subprocess
import yaml
import shutil

from sophios.main import main
from sophios.cli import get_args


def test_generate_cwl_workflow() -> None:
"""
Test that running sophios with --generate_cwl_workflow produces the correct cwl file
"""
# remove output directory in case it exists to avoid false test pass
out_path = pathlib.Path('autogenerated')

if out_path.exists() and out_path.is_dir():
shutil.rmtree(out_path)

yaml_path = str(pathlib.Path(__file__).parent.parent.resolve() / "docs/tutorials/helloworld.wic")

args = ["sophios", "--yaml", yaml_path, "--generate_cwl_workflow"]

# run sophios with args
subprocess.run(args)

with open("autogenerated/helloworld.cwl", "r") as cwl_file:
result_dict = yaml.safe_load(cwl_file)

with open(
str(pathlib.Path(__file__).parent.resolve() / "data/cwl/helloworld.cwl"), "r"
) as cwl_file:
actual_dict = yaml.safe_load(cwl_file)

assert result_dict == actual_dict
Loading