This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch tpollard/temp in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 577d29b1ea9913a71206ef27782a8d0b760144b0 Author: Tom Pollard <[email protected]> AuthorDate: Mon Nov 25 14:29:31 2019 +0000 Reset event loop in scheduler if subprocessed & pytest timeout --- .gitlab-ci.yml | 2 +- src/buildstream/_scheduler/scheduler.py | 4 ++++ src/buildstream/_stream.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f393be5..f3f8036 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ stages: variables: PYTEST_ADDOPTS: "--color=yes" INTEGRATION_CACHE: "${CI_PROJECT_DIR}/cache/integration-cache" - PYTEST_ARGS: "--color=yes --integration -n 2" + PYTEST_ARGS: "--color=yes --timeout=1 --integration -n 2" TEST_COMMAND: "tox -- ${PYTEST_ARGS}" EXTERNAL_TESTS_COMMAND: "tox -e py{35,36,37}-external -- ${PYTEST_ARGS}" COVERAGE_PREFIX: "${CI_JOB_NAME}." diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py index 886867d..6ee20bd 100644 --- a/src/buildstream/_scheduler/scheduler.py +++ b/src/buildstream/_scheduler/scheduler.py @@ -235,6 +235,10 @@ class Scheduler: failed = any(queue.any_failed_elements() for queue in self.queues) self.loop = None + # Unset the global event loop, if subprocessed + if subprocessed: + asyncio.set_event_loop_policy(None) + # Notify that the loop has been reset self._notify_front(Notification(NotificationType.RUNNING)) diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index e62c255..9fdbcd9 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -172,6 +172,7 @@ class Stream: # We can now launch another async self.loop = asyncio.new_event_loop() + asyncio.set_event_loop(self.loop) self._connect_signals() self._start_listening() self.loop.set_exception_handler(self._handle_exception)
