BasPH commented on a change in pull request #5200: [AIRFLOW-4401] Use managers 
for Queue synchronization
URL: https://github.com/apache/airflow/pull/5200#discussion_r279521118
 
 

 ##########
 File path: airflow/contrib/executors/kubernetes_executor.py
 ##########
 @@ -734,15 +741,17 @@ def sync(self):
 
         KubeResourceVersion.checkpoint_resource_version(last_resource_version)
 
-        for i in range(min((self.kube_config.worker_pods_creation_batch_size, 
self.task_queue.qsize()))):
-            task = self.task_queue.get()
-
+        for i in range(self.kube_config.worker_pods_creation_batch_size):
             try:
-                self.kube_scheduler.run_next(task)
-            except ApiException:
-                self.log.exception('ApiException when attempting ' +
-                                   'to run task, re-queueing.')
-                self.task_queue.put(task)
+                task = self.task_queue.get_no_wait()
+                try:
+                    self.kube_scheduler.run_next(task)
+                except ApiException:
+                    self.log.exception('ApiException when attempting ' +
+                                       'to run task, re-queueing.')
 
 Review comment:
   This fits on a single 110 char line
   
   ```python
                       self.log.exception('ApiException when attempting to run 
task, re-queueing.')
   ```

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


With regards,
Apache Git Services

Reply via email to