-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag to only compile workflow to cwl without running (#272)
* Add flag to only compile workflow to cwl without running * Switch --generate_cwl_workflow to group_run * Add test for --generate_cwl_workflow * Update generate cwl test to use helloworld from tutorials --------- Co-authored-by: Sameeul Bashir Samee <sameeul@gmail.com>
- Loading branch information
1 parent
e889cfa
commit 1e797b5
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |