How to fetch a launch plan using flyte api's without specifying a sha?

211 views Asked by At

I would like to use the flyte api's to fetch the latest a launchplan for a deployment environment without specifying the sha.

1

There are 1 answers

2
kaylindris On

Users are encouraged to specify the SHA when referencing Launch Plans or any other Flyte entity. However, there is one exception. Flyte has the notion of an active launch plan. For a given project/domain/name combination, a Launch Plan can have any number of versions. All four fields combined identify one specific Launch Plan. Those four fields are the primary key. One, at most one, of those launch plans can also be what we call 'active'.

To see which ones are active, you can use the list-active-launch-plans command in flyte-cli

(flyte) captain@captain-mbp151:~ [k8s: flytemain] $ flyte-cli -p skunkworks -d production list-active-launch-plans -l 200 | grep TestFluidDynamics
NONE                           248935c0f189c9286f0fe13d120645ddf003f339           lp:skunkworks:production:TestFluidDynamics:248935c0f189c9286f0fe13d120645ddf003f339

However, please be aware that if a launch plan is active, and has a schedule, that schedule will run. There is no way to make a launch plan "active" but disable its schedule (if it has one).

If you would like to set a launch plan as active, you can do so with the update-launch-plan command.

First find the version you want (results truncated):

(flyte) captain@captain-mbp151:~ [k8s: flytemain] $ flyte-cli -p skunkworks -d staging list-launch-plan-versions -n TestFluidDynamics
Using default config file at /Users/captain/.flyte/config
Welcome to Flyte CLI! Version: 0.7.0b2
Launch Plan Versions Found for skunkworks:staging:TestFluidDynamics

Version                                            Urn                                                                              Schedule                       Schedule State
d4cf71c20ce987a4899545ae01286f42297a8f3b           lp:skunkworks:staging:TestFluidDynamics:d4cf71c20ce987a4899545ae01286f42297a8f3b
9d3e8d156f7ba0c9ac338b5d09949e88eed1f6c2           lp:skunkworks:staging:TestFluidDynamics:9d3e8d156f7ba0c9ac338b5d09949e88eed1f6c2
248935c0f189c928b6ffe13d120645ddf003f339           lp:skunkworks:staging:TestFluidDynamics:248935c0f189c928b6ffe13d120645ddf003f339
...

Then

flyte-cli update-launch-plan --state active -u lp:skunkworks:staging:TestFluidDynamics:d4cf71c20ce987a4899545ae01286f42297a8f3b