diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2019-10-21 14:38:07 +0100 |
---|---|---|
committer | Valentin David <valentin.david@codethink.co.uk> | 2020-03-10 13:20:39 +0100 |
commit | fc6b3f37f173fd19e5a2593b7bf8cce40f03c615 (patch) | |
tree | aa1beadb323d54f526c7e4609d188db3e2ea63d0 | |
parent | 17acbd3dfda90017e2ffcbec73600f61a19f4492 (diff) | |
download | buildstream-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.py | 6 |
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() |