dimberman commented on a change in pull request #10996:
URL: https://github.com/apache/airflow/pull/10996#discussion_r493846299



##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -681,6 +714,78 @@ def _change_state(self,
                 self.log.debug('Could not find key: %s', str(key))
         self.event_buffer[key] = state, None
 
+    def try_adopt_task_instances(self, tis: List[TaskInstance]) -> 
List[TaskInstance]:
+        tis_to_flush = [ti for ti in tis if not ti.external_executor_id]
+        worker_uuids = [ti.external_executor_id for ti in tis]
+        pod_ids = {
+            create_pod_id(dag_id=ti.dag_id, task_id=ti.task_id): ti
+            for ti in tis if ti.external_executor_id
+        }
+        kube_client: client.CoreV1Api = self.kube_client
+        for worker_uuid in worker_uuids:
+            kwargs = {
+                'label_selector': 'airflow-worker={}'.format(worker_uuid)
+            }
+            pod_list = kube_client.list_namespaced_pod(
+                namespace=self.kube_config.kube_namespace,
+                **kwargs
+            )
+            for pod in pod_list.items:

Review comment:
       @kaxil pod_list is not a dict. items is actually a member variable. That 
wouldn't work.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to