dstandish commented on code in PR #28776:
URL: https://github.com/apache/airflow/pull/28776#discussion_r1065146913
##########
airflow/executors/kubernetes_executor.py:
##########
@@ -778,26 +778,28 @@ def adopt_launched_task(
assert self.scheduler_job_id
self.log.info("attempting to adopt pod %s", pod.metadata.name)
- pod.metadata.labels["airflow-worker"] =
pod_generator.make_safe_label_value(self.scheduler_job_id)
pod_id = annotations_to_key(pod.metadata.annotations)
if pod_id not in pod_ids:
self.log.error("attempting to adopt taskinstance which was not
specified by database: %s", pod_id)
return
+ new_worker_id_label =
pod_generator.make_safe_label_value(self.scheduler_job_id)
try:
kube_client.patch_namespaced_pod(
name=pod.metadata.name,
namespace=pod.metadata.namespace,
- body=PodGenerator.serialize_pod(pod),
+ body={"metadata": {"labels": {"airflow-worker":
new_worker_id_label}}},
)
- pod_ids.pop(pod_id)
- self.running.add(pod_id)
except ApiException as e:
self.log.info("Failed to adopt pod %s. Reason: %s",
pod.metadata.name, e)
+ return
+
+ pod_ids.pop(pod_id)
Review Comment:
```suggestion
del pod_ids[pod_id]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]