-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference_task_target.py
More file actions
34 lines (23 loc) · 1.04 KB
/
Copy pathreference_task_target.py
File metadata and controls
34 lines (23 loc) · 1.04 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
"""Target workflow for the reference_task / reference_launch_plan examples.
Run this first — it deploys ``greet_env.greet`` and ``flytekit_workflow.greet_wf``
to the cluster, which the reference examples then invoke. Note: tasks must be
*deployed* (not just run) to be resolvable by reference.
"""
import flyte_migrate # noqa: F401, I001
from flytekit import task, workflow
@task
def greet(name: str) -> str:
return f"Hello, {name}!"
@workflow
def greet_wf(name: str) -> str:
return greet(name=name)
if __name__ == "__main__":
from pathlib import Path
import flyte
# Pin the bundle root to the repo root (same as v2's deploy.py pattern) so the
# code bundle includes src/flyte_migrate regardless of where this is run from.
flyte.init_from_config(root_dir=Path(__file__).parent.parent)
# Deploy the same way as v2: the workflow's parent env depends on every
# shimmed task env, so one flyte.deploy call registers everything.
deployments = flyte.deploy(greet_wf.parent_env())
print(deployments[0].summary_repr())