Reference launch plans#
A reference launch plan references previously defined, serialized, and registered launch plans. You can reference launch plans from other projects and create workflows that use launch plans declared by others.
When you create a reference launch plan, be sure to verify that the workflow interface corresponds to that of the referenced workflow.
Note
Reference launch plans cannot be run locally. To test locally, mock them out.
Example#
In this example, we create a reference launch plan for the simple_wf
workflow from the Flytesnacks repository.
Clone the Flytesnacks repository:
git clone [email protected]:flyteorg/flytesnacks.git
Navigate to the
basics
directory:
cd flytesnacks/examples/basics
Register the
simple_wf
workflow:
union register --project flytesnacks --domain development --version v1 basics/workflow.py.
Create a file called
simple_wf_ref_lp.py
and copy the following code into it:
from flytekit import reference_launch_plan, workflow, map_task
@reference_launch_plan(
project="flytesnacks",
domain="development",
name="basics.workflow.simple_wf",
version="v1",
)
def simple_wf_lp(
x: list[int], y: list[int]
) -> float:
return 1.0
@workflow
def run_simple_wf() -> float:
x = [-8, 2, 4]
y = [-2, 4, 7]
return simple_wf_lp(x=x, y=y)
Register the
run_simple_wf
workflow:
union register simple_wf_ref_lp.py
In the Union UI, run the workflow
run_simple_wf
.