diff options
author | Jürg Billeter <j@bitron.ch> | 2019-10-10 11:20:28 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-10-15 10:55:34 +0200 |
commit | bbc6748a3616cffd83a8b2f4aac02b4c29939d9e (patch) | |
tree | 3959a3349adabc17db842b20a56eee33a425da79 /src/buildstream | |
parent | 8a5e9c69b12b09a958a395a101c1b5d17f5ece9f (diff) | |
download | buildstream-bbc6748a3616cffd83a8b2f4aac02b4c29939d9e.tar.gz |
scheduler.py: Call is_fork_allowed() right before spawning jobs
gRPC channels might be opened after the scheduler has already been
started. Make sure channels are closed right before spawning jobs.
Diffstat (limited to 'src/buildstream')
-rw-r--r-- | src/buildstream/_scheduler/scheduler.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py index 6133cbfd7..08db1a1e9 100644 --- a/src/buildstream/_scheduler/scheduler.py +++ b/src/buildstream/_scheduler/scheduler.py @@ -165,8 +165,6 @@ class Scheduler(): # def run(self, queues, casd_process): - assert self.context.is_fork_allowed() - # Hold on to the queues to process self.queues = queues @@ -408,6 +406,13 @@ class Scheduler(): # If that happens, do another round. process_queues = any(q.dequeue_ready() for q in self.queues) + # Check whether fork is allowed before starting jobs + if not self.context.is_fork_allowed(): + message = Message(MessageType.BUG, "Fork is not allowed", detail="Background threads are active") + self._notify(Notification(NotificationType.MESSAGE, message=message)) + self.terminate_jobs() + return + # Start the jobs # for job in ready: |