-
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.
- Loading branch information
Vasu Jaganath
committed
Jun 3, 2024
1 parent
061c3f3
commit 969e1bd
Showing
3 changed files
with
51 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
steps: | ||
toString: | ||
in: | ||
input: !ii 27 | ||
out: | ||
- output: !& string_int | ||
echo: | ||
when: '$(inputs.message < "27")' | ||
in: | ||
message: !* string_int |
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,31 @@ | ||
from wic.api.pythonapi import Step, Workflow | ||
|
||
|
||
def workflow() -> Workflow: | ||
# conditional on input | ||
# step toString | ||
toString = Step(clt_path='../../cwl_adapters/toString.cwl') | ||
toString.input = 27 | ||
# step echo | ||
echo = Step(clt_path='../../cwl_adapters/echo.cwl') | ||
echo.message = toString.output | ||
# add a when clause | ||
# alternate js syntax | ||
# echo.when = '$(inputs["message"] < 27)' | ||
echo.when = '$(inputs.message < 27)' | ||
# since the condition is not met the echo step is skipped! | ||
|
||
# arrange steps | ||
steps = [toString, echo] | ||
|
||
# create workflow | ||
filename = 'when_pyapi_py' # .yml | ||
wkflw = Workflow(steps, filename) | ||
return wkflw | ||
|
||
|
||
# Do NOT .run() here | ||
|
||
if __name__ == '__main__': | ||
when_wic = workflow() | ||
when_wic.run() # .run() here inside main |
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