You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/10 22:04:41 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #15263: Add worker_pod_pending_timeout support

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



##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -589,6 +598,44 @@ def sync(self) -> None:
                 break
         # pylint: enable=too-many-nested-blocks
 
+        # Run any pending timed events
+        next_event = self.event_scheduler.run(blocking=False)
+        self.log.debug("Next timed event is in %f", next_event)
+
+    def _check_worker_pods_pending_timeout(self):
+        """Check if any pending worker pods have timed out"""
+        timeout = self.kube_config.worker_pods_pending_timeout
+        self.log.debug('Looking for pending worker pods older than %d seconds', timeout)
+
+        kwargs = {
+            'limit': self.kube_config.worker_pods_pending_timeout_batch_size,
+            'field_selector': 'status.phase=Pending',
+            'label_selector': f'airflow-worker={self.scheduler_job_id}',

Review comment:
       Yeah I think it would be better to do `kubernetes_executor=True` and catch error (`NotFound` and similar errors) in that loop to avoid race condition.




-- 
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:
users@infra.apache.org