brief-family-9488
09/03/2025, 4:54 PMancient-wolf-19325
09/03/2025, 4:54 PMancient-wolf-19325
09/03/2025, 4:56 PMbrief-family-9488
09/03/2025, 5:00 PMancient-wolf-19325
09/03/2025, 5:00 PMancient-wolf-19325
09/03/2025, 5:01 PMLaunchPlan.get_or_create()
method in Flytekit, referencing the target workflow and specifying any default or fixed inputs as needed. When you invoke this launch plan from another workflow, it will start a new, external execution of the specified workflow, decoupled from the parent workflowβs execution context.
Example:
from flytekit import LaunchPlan
external_lp = LaunchPlan.get_or_create(
workflow=target_workflow,
name="external_workflow_lp",
default_inputs={"param": value}
)
Calling external_lp()
within a workflow will trigger the external workflow execution. For more, see the subworkflows and external workflows guide. Would you like a full example with workflow definitions?
Sources:
- subworkflows and external workflows guide π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.brief-family-9488
09/03/2025, 5:03 PMancient-wolf-19325
09/03/2025, 5:03 PMancient-wolf-19325
09/03/2025, 5:04 PMfrom flytekit import task, workflow
@task
def add_one(x: int) -> int:
return x + 1
@workflow
def increment_wf(x: int) -> int:
return add_one(x=x)
2. Create a launch plan for the target workflow:
from flytekit import LaunchPlan
increment_lp = LaunchPlan.get_or_create(
increment_wf,
name="increment_lp",
default_inputs={"x": 10}
)
3. Use the launch plan in another workflow to trigger the external execution:
from flytekit import workflow
@workflow
def main_wf() -> int:
# This triggers an external execution of increment_wf via the launch plan
return increment_lp()
When main_wf
runs, it will launch a new, independent execution of increment_wf
using the launch plan, and the result will be returned to main_wf
. You can override default inputs by passing arguments to increment_lp()
.
This approach ensures the triggered workflow runs as a separate execution, with its own execution ID and context, as described in the Flyte subworkflows and external workflows guide.
Sources:
- Flyte subworkflows and external workflows guide π 0 button π 0 button π‘ Hint: Mention @runllm in the thread for followups.