This is an automated email from the ASF dual-hosted git repository.

akitouni pushed a commit to branch abderrahim/quit-build
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 5ec39016a7bca07104782c20f3ec9c06bf9cd51a
Author: Abderrahim Kitouni <[email protected]>
AuthorDate: Sat Apr 5 08:40:45 2025 +0100

    scheduler: Stop scheduling from the imperative queue when asked to quit
    
    For instance, we shouldn't schedule new build jobs when asked to
    quit. However, not considering the build queue at all would miss
    pushing newly built elements.
    
    What this commit does is:
    * Pull elements forward through all queues (including the ones we no
    longer need)
    * Only schedule jobs after the imperative queue
    
    This means that elements in the build queue (or any imperative queue)
    will still get passed to the following queues, but no new build jobs
    get scheduled.
    
    Fixes https://github.com/apache/buildstream/issues/1787
---
 src/buildstream/_scheduler/scheduler.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/_scheduler/scheduler.py 
b/src/buildstream/_scheduler/scheduler.py
index 5b475daea..7f20084cf 100644
--- a/src/buildstream/_scheduler/scheduler.py
+++ b/src/buildstream/_scheduler/scheduler.py
@@ -361,7 +361,7 @@ class Scheduler:
                     # Here the `queues` list will consists of the imperative 
queue along with
                     # any subsequent queues, this means elements will be 
carried only from the
                     # imerative queue onwards, and only post-imperative jobs 
will be processed.
-                    queues = self.queues[self.queues.index(queue) :]
+                    queues = self.queues[self.queues.index(queue) + 1 :]
                     break
             else:
                 # No imperative queue was marked, stop queueing any jobs
@@ -371,7 +371,7 @@ class Scheduler:
 
             # Pull elements forward through queues
             elements = []
-            for queue in queues:
+            for queue in self.queues:
                 queue.enqueue(elements)
                 elements = list(queue.dequeue())
 

Reply via email to