summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2020-07-04 17:42:24 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2020-07-06 18:07:53 +0000
commit7dd880048ce6eaf8fe6d49b8dfa84bfd5629bc12 (patch)
tree967e023e03890dcd6afa1200b8ed9f9624d04960
parentf701a80d19fb0ef87e339ef32ecdd098a936b813 (diff)
downloadbuildstream-7dd880048ce6eaf8fe6d49b8dfa84bfd5629bc12.tar.gz
_stream.py: Stop using a 'TERMINATED' event to know the state of the scheduler
We are calling the scheduler, and it returning correctly already tells us this.
-rw-r--r--src/buildstream/_scheduler/scheduler.py2
-rw-r--r--src/buildstream/_stream.py7
2 files changed, 3 insertions, 6 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py
index 6e7eb4405..41ff1189f 100644
--- a/src/buildstream/_scheduler/scheduler.py
+++ b/src/buildstream/_scheduler/scheduler.py
@@ -59,7 +59,6 @@ class NotificationType(FastEnum):
TERMINATE = "terminate"
QUIT = "quit"
RUNNING = "running"
- TERMINATED = "terminated"
SUSPEND = "suspend"
UNSUSPEND = "unsuspend"
@@ -262,7 +261,6 @@ class Scheduler:
# Notify the frontend that we're terminated as it might be
# from an interactive prompt callback or SIGTERM
- self._notify(Notification(NotificationType.TERMINATED))
self.loop.call_soon(self._terminate_jobs_real)
# Block this until we're finished terminating jobs,
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 707d8c086..9a00ecdc0 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -101,7 +101,7 @@ class Stream:
self._interrupt_callback = interrupt_callback
self._notifier = self._scheduler._stream_notification_handler # Assign the schedulers notification handler
self._scheduler_running = False
- self._scheduler_terminated = False
+ self._terminated = False
self._suspended = False
# init()
@@ -1078,7 +1078,7 @@ class Stream:
#
@property
def terminated(self):
- return self._scheduler_terminated
+ return self._terminated
# terminate()
#
@@ -1087,6 +1087,7 @@ class Stream:
def terminate(self):
notification = Notification(NotificationType.TERMINATE)
self._notify(notification)
+ self._terminated = True
# quit()
#
@@ -1655,8 +1656,6 @@ class Stream:
self._ticker_callback()
elif notification.notification_type == NotificationType.RUNNING:
self._scheduler_running = not self._scheduler_running
- elif notification.notification_type == NotificationType.TERMINATED:
- self._scheduler_terminated = True
else:
raise StreamError("Unrecognised notification type received: {}".format(notification.notification_type))