diff options
author | Benjamin Schubert <contact@benschubert.me> | 2020-07-04 17:42:24 +0000 |
---|---|---|
committer | Benjamin Schubert <contact@benschubert.me> | 2020-07-05 15:09:17 +0000 |
commit | 1b7fa99b73d4aa2be958c8830f412eace0ea2089 (patch) | |
tree | 4974f80b78d8ae25ed8e9cb2ba4ca84faa4ce5bb | |
parent | b65fb9ae0406ea2ae4511985c84b20d6a4ed81fb (diff) | |
download | buildstream-1b7fa99b73d4aa2be958c8830f412eace0ea2089.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.py | 2 | ||||
-rw-r--r-- | src/buildstream/_stream.py | 7 |
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 4f88986a7..81a17cf50 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() @@ -1036,7 +1036,7 @@ class Stream: # @property def terminated(self): - return self._scheduler_terminated + return self._terminated # terminate() # @@ -1045,6 +1045,7 @@ class Stream: def terminate(self): notification = Notification(NotificationType.TERMINATE) self._notify(notification) + self._terminated = True # quit() # @@ -1613,8 +1614,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)) |