summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2019-10-21 14:38:07 +0100
committerValentin David <valentin.david@codethink.co.uk>2020-03-10 13:20:39 +0100
commitfc6b3f37f173fd19e5a2593b7bf8cce40f03c615 (patch)
treeaa1beadb323d54f526c7e4609d188db3e2ea63d0
parent17acbd3dfda90017e2ffcbec73600f61a19f4492 (diff)
downloadbuildstream-fc6b3f37f173fd19e5a2593b7bf8cce40f03c615.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--buildstream/_scheduler/scheduler.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py
index 101faccce..131cbb1d5 100644
--- a/buildstream/_scheduler/scheduler.py
+++ b/buildstream/_scheduler/scheduler.py
@@ -137,6 +137,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()