summaryrefslogtreecommitdiff
path: root/src/buildstream/_stream.py
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2020-07-04 18:20:35 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2020-07-06 18:07:53 +0000
commitcb2acc31743d6e208a7977288485578ca17effdd (patch)
tree55ba99140008a72e9d762b8319613bbbabe586b6 /src/buildstream/_stream.py
parent61dd3d603d66bd8e92e87060e1d46993c71badf3 (diff)
downloadbuildstream-cb2acc31743d6e208a7977288485578ca17effdd.tar.gz
scheduler.py: Remove all usage of notifications
Call directly the relevant methods from the stream to the scheduler
Diffstat (limited to 'src/buildstream/_stream.py')
-rw-r--r--src/buildstream/_stream.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index b8f42f582..cb1e84f74 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -43,8 +43,6 @@ from ._scheduler import (
BuildQueue,
PullQueue,
ArtifactPushQueue,
- NotificationType,
- Notification,
)
from .element import Element
from ._pipeline import Pipeline
@@ -93,11 +91,8 @@ class Stream:
context.messenger.set_state(self._state)
- self._scheduler = Scheduler(
- context, session_start, self._state, self._notification_queue, interrupt_callback, ticker_callback
- )
+ self._scheduler = Scheduler(context, session_start, self._state, interrupt_callback, ticker_callback)
self._session_start_callback = session_start_callback
- self._notifier = self._scheduler._stream_notification_handler # Assign the schedulers notification handler
self._running = False
self._terminated = False
self._suspended = False
@@ -1083,8 +1078,7 @@ class Stream:
# Terminate jobs
#
def terminate(self):
- notification = Notification(NotificationType.TERMINATE)
- self._notify(notification)
+ self._scheduler.terminate()
self._terminated = True
# quit()
@@ -1094,8 +1088,7 @@ class Stream:
# of ongoing jobs
#
def quit(self):
- notification = Notification(NotificationType.QUIT)
- self._notify(notification)
+ self._scheduler.stop()
# suspend()
#
@@ -1103,15 +1096,11 @@ class Stream:
#
@contextmanager
def suspend(self):
- # Send the notification to suspend jobs
- notification = Notification(NotificationType.SUSPEND)
- self._notify(notification)
+ self._scheduler.suspend()
self._suspended = True
yield
self._suspended = False
- # Unsuspend jobs on context exit
- notification = Notification(NotificationType.UNSUSPEND)
- self._notify(notification)
+ self._scheduler.resume()
#############################################################
# Private Methods #
@@ -1645,11 +1634,6 @@ class Stream:
return element_targets, artifact_refs
- def _notify(self, notification):
- # Stream to scheduler notifcations on left side
- self._notification_queue.appendleft(notification)
- self._notifier()
-
# _handle_compression()
#