<@U06RKAMK0UC> is it possible to call a specific v...
# ask-ai
b
@ancient-wolf-19325 is it possible to call a specific version of a subworkflow from a main workflow
a
Reasoning Complete! πŸ€– πŸ” Searched knowledge base: I'll look up whether calling a specific version of a subworkflow from a main workflow is supported, so I can give you an accurate answer. β€’ Searching over 10 data sources from the following: File, Github File, Github Issue, Web β€’ Found 66 documents that could be relevant from the following data sources: Github File, Github Issue, Github Pull Request, Web Content. β€’ Filtered down to the top 30 most relevant documents. ✍️ Generated answer: I have found clear information about how Flyte handles versioning for subworkflows and the recommended approach if you need to call a specific version. I'm ready to provide a complete answer.
No, it is not possible to call a specific version of a subworkflow from a main workflow. Subworkflows are inlined at registration time, meaning the subworkflow's code and structure are embedded into the parent workflow, and versioning is not applied at the subworkflow call level. Only the version of the parent workflow matters at execution; you cannot specify a different version for a subworkflow within the workflow definition. If you need to execute a specific version of a workflow from another workflow, you must use a launch plan, which triggers an external workflow execution and allows you to specify the version explicitly. For more details, see the explanation of subworkflows and external workflows in the Flyte documentation and the distinction between subworkflows and launch plans in the Flyte fundamentals guide. Would you like a step-by-step example of how to use launch plans to achieve version-specific workflow execution? Sources: - Flyte documentation - Flyte fundamentals guide πŸ‘ 0 button πŸ‘Ž 0 button πŸ’‘ Hint: Mention @runllm in the thread for followups.
b
@ancient-wolf-19325 how do you create a launch plan with external workflow triggers
a
Reasoning Complete! πŸ€– πŸ” Searched knowledge base: I'll look up the best way to create a launch plan in Flyte that can be triggered from outside the workflow, so I can give you clear, step-by-step instructions. β€’ Searching over 10 data sources from the following: File, Github File, Github Issue, Web β€’ Found 57 documents that could be relevant from the following data sources: Github File, Github Issue, Github Pull Request. β€’ Filtered down to the top 30 most relevant documents. ✍️ Generated answer: I have found clear, step-by-step information on how to create a launch plan in Flyte that can be triggered externally. I'm ready to provide you with a complete answer.
To create a launch plan that triggers an external workflow (i.e., executes a specific workflow version as a separate execution), use the
LaunchPlan.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:
Copy code
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.
b
@ancient-wolf-19325 yes
a
Reasoning Complete! πŸ€– πŸ” Searched knowledge base: I'll look up a full example that shows how to define workflows and launch plans in Flyte, and how to use them to trigger external workflow executions. β€’ Searching over 10 data sources from the following: File, Github File, Github Issue, Web β€’ Found 51 documents that could be relevant from the following data sources: Github File, Github Issue, Github Pull Request, Web Content. β€’ Filtered down to the top 30 most relevant documents. ✍️ Generated answer: I have all the information needed to give you a complete, step-by-step example of how to define workflows and launch plans in Flyte, and how to use them to trigger external workflow executions.
Here’s a step-by-step example of creating and using a launch plan to trigger an external workflow execution in Flyte: 1. Define the target workflow (the one you want to trigger externally):
Copy code
from 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:
Copy code
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:
Copy code
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.