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 10:51:42 UTC

[GitHub] [airflow] ashb commented on a change in pull request #6732: fixes scheduler queue bug

ashb commented on a change in pull request #6732: fixes scheduler queue bug
URL: https://github.com/apache/airflow/pull/6732#discussion_r354236425
 
 

 ##########
 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:
   This change is just to  make the test executor behave more like the other ones that have limited parallelism right?

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