When using `flytectl` , there are a few options ar...
# ask-the-community
s
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?
k
we don’t support archiving/activating LP for now. would you mind creating an issue for it. [flyte-core]
s
For sure
s
@Kevin Su, it should be possible to activate a launchplan with pyflyte, correct? https://github.com/flyteorg/flytekit/pull/1588
k
Sorry. I forgot we already support that. @Samhita Alla Thanks for the reminder. @Sam Eckert could you give it a try
s
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?
k
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
s
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.
s
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.
s
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.
s
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...
s
Oh multiple active launch plans?
s
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!
104 Views