Summary
The user is asking about setting workflow labels and annotations for the default launch plan in Flyte through code, having faced an error indicating that only named launch plans can have additional properties. They prefer not to create a new launch plan with labels to keep the user experience simple. The user mentions that labels are only supported on the default launch plan and discusses the reasons for this limitation, such as challenges in natural specification and the need for consistency. They suggest that it would be helpful to have an argument in the @workflow
decorator to specify labels directly in the workflow definition and propose creating an issue for this suggestion.
swarup
ytong
i remember the thinking was it wasn’t pure… like the workflow decorator should only affect the workflow, not the launch plan. but I think it’s the right time to revisit that, and maybe be more flexible about it, esp since we already extract out default args to the workflow into the default launch plan as well.
swarup
will do!
ytong
mind making an issue for this?
swarup
yeah that makes sense - for us we would love to specify it somewhere in the workflow definition itself so I'd hope the isolation point would hold there
swarup
something like an argument in the @workflow
would be ideal!
ytong
iirc there were multiple reasons, not sure how strict they are today. one was because it was difficult to find a natural way to specify it. How would you like to specify it? (like what syntax?) Also there may have been the thought that the default launch plan should be create-able in isolation, with only the workflow definition - if the backend created a default launch plan and flytekit created one, they should be identical.
david.espejo
<@U04UAHP1WNA> unfortunately that seem to be the case, after looking at the <https://github.com/flyteorg/flytekit/blob/b6f30e6165e2d1d88cb939db865c3473311d6273/flytekit/core/launch_plan.py#L238-L254|relevant code> it seems like labels are only supported on the default launchplan. Not exactly sure why
swarup
creating a new launch plan with the label (that isn't the default plan) isn't ideal since users now have to explicitly switch the launch plan when launching the workflow
swarup
hey sorry for the delay here! so I tried that but I got this error:
ValueError: Only named launchplans can be created that have other properties.
it seems like we're not able to add labels to the default launch plan, only explicitly named ones
swarup
:wave: is there any way to set <https://docs.flyte.org/en/latest/user_guide/productionizing/workflow_labels_and_annotations.html|workflow labels/annotations> for the <https://docs.flyte.org/en/latest/flyte_fundamentals/tasks_workflows_and_launch_plans.html#launch-plans|default launch plan> created during registration?
blaketastic2
swarup
if we could set it when we define the workflow in code that would be ideal!