summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildstream/_scheduler/scheduler.py5
-rw-r--r--src/buildstream/_stream.py5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/buildstream/_scheduler/scheduler.py b/src/buildstream/_scheduler/scheduler.py
index 45f6a39d4..3c491b92d 100644
--- a/src/buildstream/_scheduler/scheduler.py
+++ b/src/buildstream/_scheduler/scheduler.py
@@ -58,6 +58,7 @@ class NotificationType(FastEnum):
TERMINATED = "terminated"
SUSPEND = "suspend"
UNSUSPEND = "unsuspend"
+ SUSPENDED = "suspended"
# Notification()
@@ -399,6 +400,8 @@ class Scheduler():
if not self.suspended:
self._suspendtime = datetime.datetime.now()
self.suspended = True
+ # Notify that we're suspended
+ self._notify(Notification(NotificationType.SUSPENDED))
for job in self._active_jobs:
job.suspend()
@@ -411,6 +414,8 @@ class Scheduler():
for job in self._active_jobs:
job.resume()
self.suspended = False
+ # Notify that we're unsuspended
+ self._notify(Notification(NotificationType.SUSPENDED))
self._starttime += (datetime.datetime.now() - self._suspendtime)
self._notify(Notification(NotificationType.SCHED_START_TIME, time=self._starttime))
self._suspendtime = None
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 77d746ab7..e3d5eee89 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -93,6 +93,7 @@ class Stream():
self._notifier = self._scheduler._stream_notification_handler # Assign the schedulers notification handler
self._scheduler_running = False
self._scheduler_terminated = False
+ self._scheduler_suspended = False
# init()
#
@@ -1087,7 +1088,7 @@ class Stream():
#
@property
def suspended(self):
- return self._scheduler.suspended
+ return self._scheduler_suspended
# terminated
#
@@ -1678,6 +1679,8 @@ class Stream():
self._scheduler_running = not self._scheduler_running
elif notification.notification_type == NotificationType.TERMINATED:
self._scheduler_terminated = True
+ elif notification.notification_type == NotificationType.SUSPENDED:
+ self._scheduler_suspended = not self._scheduler_suspended
else:
raise StreamError("Unrecognised notification type received")