Skip to content

Commit e682004

Browse files
authored
fix: add run_id annotation to pod metadata (#2213)
* add run_id annotation to pod metadata * cleanup kubernetes annotation/label setting
1 parent e1ae62c commit e682004

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

metaflow/plugins/argo/argo_workflows.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,15 @@ def _compile_workflow_template(self):
849849
Metadata()
850850
.labels(self._base_labels)
851851
.label("app.kubernetes.io/name", "metaflow-task")
852-
.annotations(annotations)
853-
.annotations(self._base_annotations)
852+
.annotations(
853+
{
854+
**annotations,
855+
**self._base_annotations,
856+
**{
857+
"metaflow/run_id": "argo-{{workflow.name}}"
858+
}, # we want pods of the workflow to have the run_id as an annotation as well
859+
}
860+
)
854861
)
855862
# Set the entrypoint to flow name
856863
.entrypoint(self.flow.name)

metaflow/plugins/kubernetes/kubernetes.py

-9
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,6 @@ def create_job_object(
669669
for name, value in system_annotations.items():
670670
job.annotation(name, value)
671671

672-
(
673-
job.annotation("metaflow/run_id", run_id)
674-
.annotation("metaflow/step_name", step_name)
675-
.annotation("metaflow/task_id", task_id)
676-
.annotation("metaflow/attempt", attempt)
677-
.label("app.kubernetes.io/name", "metaflow-task")
678-
.label("app.kubernetes.io/part-of", "metaflow")
679-
)
680-
681672
return job
682673

683674
def create_k8sjob(self, job):

0 commit comments

Comments
 (0)