-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_flow.py
More file actions
31 lines (19 loc) · 738 Bytes
/
Copy pathmy_flow.py
File metadata and controls
31 lines (19 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flowmium import Flow, FlowContext
from flowmium.serializers import plain_text, json_text, pkl
flow = Flow("testing")
@flow.task(serializer=json_text)
def foo() -> str:
return "Hallo world"
@flow.task({"input_str": foo}, serializer=plain_text)
def replace_letter_a(input_str: str, flowctx: FlowContext) -> str:
return input_str.replace("a", "e") + str(flowctx.task_id)
@flow.task({"input_str": foo}, serializer=pkl)
def replace_letter_t(input_str: str) -> str:
return input_str.replace("t", "d")
@flow.task(
{"first": replace_letter_t, "second": replace_letter_a}, serializer=plain_text
)
def concat(first: str, second: str) -> str:
return f"{first} {second}"
if __name__ == "__main__":
flow.run()