summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Maat <tristan.maat@codethink.co.uk>2017-10-24 13:12:27 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2017-10-26 10:50:11 +0000
commit6976ba5d8c222aee61bfd5666b5df1b07f76b9bd (patch)
treeddf9111ce2338af4965b46fb3c62f8f02b0a8134
parent315bfbfeaeda4d0acaa1381ee760cb0b6c7ac33d (diff)
downloadbuildstream-6976ba5d8c222aee61bfd5666b5df1b07f76b9bd.tar.gz
Issue #107: Stop attaching the child watcher multiple times
-rw-r--r--buildstream/_scheduler/job.py1
-rw-r--r--buildstream/_scheduler/scheduler.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/buildstream/_scheduler/job.py b/buildstream/_scheduler/job.py
index 9ac70c77c..7c7c29bb7 100644
--- a/buildstream/_scheduler/job.py
+++ b/buildstream/_scheduler/job.py
@@ -114,7 +114,6 @@ class Job():
# Wait for it to complete
self.watcher = asyncio.get_child_watcher()
- self.watcher.attach_loop(self.scheduler.loop)
self.watcher.add_child_handler(self.pid, self.child_complete, self.element)
# shutdown()
diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py
index 58a739c4b..f5f0664c1 100644
--- a/buildstream/_scheduler/scheduler.py
+++ b/buildstream/_scheduler/scheduler.py
@@ -112,7 +112,10 @@ class Scheduler():
for queue in queues:
queue.attach(self)
+ # 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()
+ asyncio.set_event_loop(self.loop)
# Add timeouts
if self.ticker_callback: