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 2019/12/05 18:25:20 UTC

[GitHub] [airflow] dimberman commented on a change in pull request #6732: [AIRFLOW-6175] fixes scheduler queue bug

dimberman commented on a change in pull request #6732: [AIRFLOW-6175] fixes scheduler queue bug
URL: https://github.com/apache/airflow/pull/6732#discussion_r354474701
 
 

 ##########
 File path: tests/executors/test_executor.py
 ##########
 @@ -55,9 +55,11 @@ def sort_by(item):
                 (_, prio, _, _) = val
                 # Sort by priority (DESC), then date,task, try
                 return -prio, date, dag_id, task_id, try_number
-            sorted_queue = sorted(self.queued_tasks.items(), key=sort_by)
 
-            for (key, (_, _, _, simple_ti)) in sorted_queue:
+            open_slots = self.parallelism - len(self.running)
+            sorted_queue = sorted(self.queued_tasks.items(), key=sort_by)
+            for _ in range(min((open_slots, len(sorted_queue)))):
+                (key, (_, _, _, simple_ti)) = sorted_queue.pop()
 
 Review comment:
   Yes. We can't test overflowing if the executor "runs" all tasks so we had to create a bottleneck :).

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


With regards,
Apache Git Services