def _label_with_context_and_execution(self): self.pod = podutils.get_pod(self.pod_name, self.pod_namespace) labels = self.pod.metadata.labels labels.setdefault(METADATA_EXECUTION_ID_LABEL_KEY, str(self.execution.id)) labels.setdefault(METADATA_CONTEXT_ID_LABEL_KEY, str(self.run_context.id)) podutils.patch_pod(self.pod_name, self.pod_namespace, {"metadata": { "labels": labels }})
def _annotate_artifacts(self, annotation_key, ids): self.pod = podutils.get_pod(self.pod_name, self.pod_namespace) annotations = self.pod.metadata.annotations all_ids_str = annotations.get(annotation_key, "[]") all_ids = json.loads(all_ids_str) all_ids.extend(ids) all_ids.sort() all_ids_str = json.dumps(all_ids) annotations[annotation_key] = all_ids_str podutils.patch_pod(self.pod_name, self.pod_namespace, {"metadata": { "annotations": annotations }})