summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-15 22:35:52 +0900
committerbst-marge-bot <marge-bot@buildstream.build>2020-05-19 09:28:33 +0000
commitf41c4dc515eac959ab8adec3c0e0d0ef92b43930 (patch)
treef8c5840d51b377f9d457aed09b21e0167e16ffc7
parenta247912c29d84ddf349dcc5d11beb5976a3b0d8a (diff)
downloadbuildstream-f41c4dc515eac959ab8adec3c0e0d0ef92b43930.tar.gz
_scheduler/scheduler.py: Reset the schedule handler at the beginning of real_schedule()
In case queuing jobs results in jobs completing, we need to reset the schedule handler at the beginning of the function and not after queueing the jobs. This fixes the failure to exit the main loop in #1312
-rw-r--r--src/buildstream/_scheduler/scheduler.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py
index ae510c2e0..43c6c9680 100644
--- a/src/buildstream/_scheduler/scheduler.py
+++ b/src/buildstream/_scheduler/scheduler.py
@@ -456,6 +456,21 @@ class Scheduler:
#
def _sched(self):
def real_schedule():
+
+ # Reset the scheduling handle before queuing any jobs.
+ #
+ # We do this right away because starting jobs can result
+ # in their being terminated and completed during the body
+ # of this function, and we want to be sure that we get
+ # called again in this case.
+ #
+ # This can happen if jobs are explicitly killed as a result,
+ # which might happen as a side effect of a crash in an
+ # abstracted frontend implementation handling notifications
+ # about jobs starting.
+ #
+ self._sched_handle = None
+
if not self.terminated:
#
@@ -464,9 +479,6 @@ class Scheduler:
#
self._sched_queue_jobs()
- # Reset the scheduling hand
- self._sched_handle = None
-
#
# If nothing is ticking then bail out
#