When using `flytectl` , there are a few options ar...
# flyte-support
c
When using
flytectl
, there are a few options around archiving/activating launchplans. I have been looking to move our wrapping code around launchplans to use
flytekit
, but I'm not seeing corresponding options. As far as I can tell, the
LaunchPlan.get_or_create
function just creates the object, but does not activate it. Am I missing something?
g
we don’t support archiving/activating LP for now. would you mind creating an issue for it. [flyte-core]
c
For sure
t
@glamorous-carpet-83516, it should be possible to activate a launchplan with pyflyte, correct? https://github.com/flyteorg/flytekit/pull/1588
g
Sorry. I forgot we already support that. @tall-lock-23197 Thanks for the reminder. @crooked-artist-67935 could you give it a try
c
Correct me if I am wrong, but that would still require calling out to a CLI right? What’s the benefit of using pyflyte here instead of flytectl?
g
pyflyte can serialize the workflow, but flytectl can’t. if only want to serialize/register/run the workflow. you can just use pyflyte. if you want to use sandbox or update some resource (task resource, execution label, etc), you have to install flytectl
t
Also if you want to activate the launch plan at the API level, you can use FlyteRemote. Take a look at the following code that activates a launch plan: https://github.com/flyteorg/flytekit/blob/3b064dca90de2d0d2d691e931aaadca56beb3a7f/flytekit/clis/sdk_in_container/launchplan.py#L61-L68.
👍 1
c
This should work! Thanks.
The only thing missing then is listing all of the active launchplan versions so we can disable them. In most cases it is probably sufficient to just get the most recent, but I'd be worried about edge cases. Fortunately, it looks like this is possible via https://github.com/flyteorg/flytekit/blob/master/flytekit/remote/remote.py#L386.
t
You don't have to manually deactivate old launch plans. When you activate the new version of a launch plan, all the old ones will be automatically deactivated.
c
Oh interesting. I think I ran the equivalent of
flytectl get launchplan -p flytesnacks -d development -o yaml  --filter.fieldSelector "state=1"
(from https://docs.flyte.org/projects/flytectl/en/latest/gen/flytectl_get_launchplan.html) but with a name parameter, and got multiple launchplans back. It is possible the name param was ignored and I accidentally disabled every launchplan across the project/domain...
t
Oh multiple active launch plans?
c
Yeah, thats what I was seeing. Let me test on my end to see if I can reproduce
I can't seem to repro. I'll update here if I am able to, but for now I'll just go on with the solution above. Thanks for the help!
👍 1
153 Views