-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference_workflow_example.py
More file actions
38 lines (26 loc) · 1.01 KB
/
Copy pathreference_workflow_example.py
File metadata and controls
38 lines (26 loc) · 1.01 KB
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
32
33
34
35
36
37
38
"""v1 ``@reference_workflow`` running on a v2 cluster.
References the ``greet_wf`` workflow deployed by reference_task_target.py
(shimmed v1 workflows register as tasks named ``flytekit_workflow.<wf_name>``).
"""
import flyte_migrate # noqa: F401, I001
from flytekit import reference_workflow, task, workflow
@reference_workflow(
project="flyte-migrate",
domain="development",
name="examples_reference_task_target_workflow.greet_wf", # deployed by reference_task_target.py
)
def remote_greet_wf(name: str) -> str:
"""Stub — this body is never executed. The real workflow runs on the cluster."""
@task
def exclaim(greeting: str) -> str:
return f"{greeting}!!!"
@workflow
def reference_workflow_wf(name: str) -> str:
greeting = remote_greet_wf(name=name)
return exclaim(greeting=greeting)
if __name__ == "__main__":
import flyte
flyte.init_from_config()
run = flyte.with_runcontext(mode="remote").run(reference_workflow_wf, name="flyte")
print(run.name)
print(run.url)