summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2019-10-21 14:38:07 +0100
committerChandan Singh <csingh43@bloomberg.net>2019-12-24 16:35:33 +0000
commit0eca9e6a4a01d1094987773bce58d9d3e501f1e8 (patch)
tree96042fbc499d9d3ce06e7a05ed660ff5fdaf2a9b
parent7fa5ccb60a6ec0c38da2bfde0118ef531bfd3697 (diff)
downloadbuildstream-0eca9e6a4a01d1094987773bce58d9d3e501f1e8.tar.gz
_scheduler/scheduler.py: Enforce SafeChildWatcher
In Python 3.8, `ThreadedChildWatcher` is the default watcher that causes issues with our scheduler. Enforce use of `SafeChildWatcher`.
-rw-r--r--src/buildstream/_scheduler/scheduler.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py
index a45da82f9..ca7e9279c 100644
--- a/src/buildstream/_scheduler/scheduler.py
+++ b/src/buildstream/_scheduler/scheduler.py
@@ -171,6 +171,12 @@ class Scheduler:
# Hold on to the queues to process
self.queues = queues
+ # NOTE: Enforce use of `SafeChildWatcher` as we generally don't want
+ # background threads.
+ # In Python 3.8+, `ThreadedChildWatcher` is the default watcher, and
+ # not `SafeChildWatcher`.
+ asyncio.set_child_watcher(asyncio.SafeChildWatcher())
+
# Ensure that we have a fresh new event loop, in case we want
# to run another test in this thread.
self.loop = asyncio.new_event_loop()