-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
3cc5232
commit d2ab96f
Showing
4 changed files
with
11 additions
and
5 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 |
---|---|---|
@@ -1,27 +1,32 @@ | ||
from pydra.design import python, workflow | ||
from pydra.engine.submitter import Submitter | ||
|
||
|
||
@python.define | ||
def Add(x: float, y: float) -> float: | ||
return x + y | ||
|
||
|
||
@python.define | ||
def Subtract(x: float, y: float) -> float: | ||
return x - y | ||
|
||
|
||
@python.define | ||
def Divide(x: float, y: float) -> float: | ||
return x / y | ||
|
||
|
||
@workflow.define | ||
def UnsafeWorkflow(a: float, b: float, c: float) -> float: | ||
add = workflow.add(Add(x=a, y=b)) | ||
divide = workflow.add(Divide(x=add.out, y=c)) | ||
subtract = workflow.add(Subtract(x=divide.out, y=b)) | ||
return subtract.out | ||
|
||
|
||
# This workflow will fail because we are trying to divide by 0 | ||
failing_workflow = UnsafeWorkflow(a=10, b=5).split(c=[3, 2 ,0]) | ||
failing_workflow = UnsafeWorkflow(a=10, b=5).split(c=[3, 2, 0]) | ||
|
||
with Submitter() as sub: | ||
result = sub(failing_workflow) | ||
result = sub(failing_workflow) |
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
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