diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-05-15 22:35:52 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-05-18 14:11:55 +0900 |
commit | 44dd378ece4917e02c080c275f2ce85a2a85126b (patch) | |
tree | 0d034153f56e49b26fb1af31ca863a8378376c7b | |
parent | a272b932ca8118f1bdc2d5b0569151ce3f51bbdb (diff) | |
download | buildstream-tristan/improve-frontend-crash-handling.tar.gz |
_scheduler/scheduler.py: Reset the schedule handler at the beginning of real_schedule()tristan/improve-frontend-crash-handling
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.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py index 15ae85e04..cf4581f00 100644 --- a/src/buildstream/_scheduler/scheduler.py +++ b/src/buildstream/_scheduler/scheduler.py @@ -459,6 +459,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: # @@ -467,9 +482,6 @@ class Scheduler: # self._sched_queue_jobs() - # Reset the scheduling hand - self._sched_handle = None - # # If nothing is ticking then bail out # |