Hi all, can I fetch a workflow with specific versi...
# flyte-support
m
Hi all, can I fetch a workflow with specific version from flyte cluster, and then create and register a launch plan for it? Something like this, but it is not working for me.
Copy code
remote = FlyteRemote(
    config=Config.auto(config_file=str(Path(__file__).parent.parent / "flytekit.config")),
    default_project=PROJECT_NAME,
    default_domain=PROJECT_DOMAIN,
)

wf = remote.fetch_workflow(
    name="<http://workflows.test.wf|workflows.test.wf>", version=version, domain=PROJECT_DOMAIN, project=PROJECT_NAME
)

lp_name = "test_lp"

wf_lp = LaunchPlan.get_or_create(
    name=lp_name,
    workflow=wf,
    default_inputs={
        "input_num": 1
    },
    schedule=CronSchedule(schedule="0 0 1 * *"),
)
a
Hi @mysterious-painter-66441
can I fetch a workflow with specific version from flyte cluster, and then create and register a launch plan for it?
absolutely. In this case you need to keep using remote, specifically the register_launch_plan method to create the LP with a remotely-fetched workflow
m
Thank for reponse! I have errors when doing
LaunchPlan.get_or_create()
How to do create launch plan using the fetched workflow? I think it will then be passed into the the
remote.register_lanch_plan
function
I am using flytekit==1.13.1
g
could you try latest flytekit? I remember it was fixed recently.
m
I have updated flytekit to 1.16.1, still get the same error.