<@U06RKAMK0UC> <added support for> `labels`<https:...
# ask-ai
a
@ancient-wolf-19325 added support for `labels` and `annotations` in the task decorator. what exactly is this use for? what is difference previously and now?
j
The addition of
labels
and
annotations
to the Flyte
@task
decorator allows users to directly specify Kubernetes labels and annotations for individual task pods and custom resource (CRD) objects (e.g., distributed jobs like PyTorch, Ray) at the task level. Previously, you could only set these via a pod template (which only affected pods, not CRDs) or by using
pyflyte run --labels ... --annotations ...
, which applied the metadata globally to all objects in a workflow execution, not per-task. Now, you can set them granularly per task, and they are propagated to both pods and CRD objects created for that task, enabling more precise control and integrations (e.g., with Kueue for gang scheduling) without affecting unrelated tasks in the workflow. See PR #6421 and issue #6238. In summary, before this change, fine-grained control over labels/annotations for individual K8s task CRDs was not possible—only pod-level or global workflow-level metadata could be set. Now, you can use
@task(labels=..., annotations=...)
to target specific tasks, which is especially useful for advanced K8s integrations and resource management. Would you like a code example or more detail? Sources: - PR #6421: Feat: Apply labels and annotations set via task decorator to pods and CR objects - Issue #6238: Allow setting metadata (labels&amp;annotations) individually on all K8s task types 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.