Reputation: 1153
I am trying to fetch an already registed Flyte Launchplan or workflow but I am not able to find the relevant API. Can you please help me?
Below is the code I took from External Workflow. It contains LaunchPlan.get_or_create
and I want something like LaunchPlan.fetch_latest('regression_line_workflow')
.
from flytekit import LaunchPlan
launch_plan = ??#LaunchPlan.get_or_create(
regression_line_wf, "regression_line_workflow", default_inputs={"val": 7, "x": [-3, 0, 3], "y": [7, 4, -2]}
)
@workflow
def nested_regression_line_lp() -> float:
# Trigger launch plan from within a workflow
return launch_plan()
Upvotes: 0
Views: 37
Reputation: 11
You can use the Flyteremote API for this. It includes a remote.fetch_launch_plan
method that you could use like this:
from flytekit.remote import FlyteRemote
from flytekit.configuration import Config
# Initialize FlyteRemote
remote = FlyteRemote(
config=Config.for_endpoint(endpoint="flyte.example.net"),
default_project="flytesnacks",
default_domain="development",
)
# Fetch the LaunchPlan
flyte_lp = remote.fetch_launch_plan(
name="workflows.example.wf", version="v1", project="flytesnacks", domain="development"
)
This is somewhat covered in the docs https://docs.flyte.org/en/latest/api/flytekit/design/control_plane.html#fetching-entities
Does this helps?
Upvotes: 0