Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KubernetesPodOperator's name in templated fields #43480

Closed
2 tasks done
anteverse opened this issue Oct 29, 2024 · 3 comments · Fixed by #46268
Closed
2 tasks done

Add KubernetesPodOperator's name in templated fields #43480

anteverse opened this issue Oct 29, 2024 · 3 comments · Fixed by #46268
Assignees
Labels

Comments

@anteverse
Copy link
Contributor

Description

Unless it's been kept out templated fields on purpose, I would like to add the param name of KubernetesPodOperator into template_fields.

My guess is that we wished to protect the pod name and guarantee the right syntax via KubernetesPodOperator._set_name. But I think we could have the best of both worlds by adding name to template_fields and have the protected name through something like self.pod_name = self._set_pod_name(name), or equivalent.

Would that be worth a shot? I'm willing to submit a short PR about this.

Thanks a lot!

Use case/motivation

The current use-case is when we explore pods from the Kubernetes side, it's easy to have pod_name=task_id but that's not sufficient when we have several DAGs with identical tasks in them.
Discriminant and dynamic information can be passed to labels or annotations since they're templated fields, but the pod name isn't.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@anteverse anteverse added kind:feature Feature Requests needs-triage label for new issues that we didn't triage yet labels Oct 29, 2024
@dosubot dosubot bot added the area:core-operators Operators, Sensors and hooks within Core Airflow label Oct 29, 2024
@potiuk
Copy link
Member

potiuk commented Oct 29, 2024

Sure. Go ahead.

@insomnes
Copy link
Contributor

@eilon246810 hi! I am very interested in this feature, so I have created my PR based on your previous one (with some extra tests).

Let me know if you'd like to recreate it yourself.

@insomnes
Copy link
Contributor

Fixing the problem with tests led me to the bug in SparkKubernetesOperator tests, so I have fixed them in addition to this feature too.

@shahar1 shahar1 assigned insomnes and unassigned anteverse Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants