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



##########
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
+        }

Review comment:
       This can be refactored similarly to 
https://github.com/apache/airflow/blob/7644c3708223afef1d9e80cdd7d991bf9cddfa8e/airflow/executors/celery_executor.py#L350-L357
   
   similar to https://github.com/apache/airflow/pull/10949#discussion_r489508144




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