summaryrefslogtreecommitdiff
path: root/distbuild
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-04-23 16:02:05 (GMT)
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-04-23 16:32:36 (GMT)
commit99b9efa9dd588afdc4f1e189380a4c71bbc7114e (patch)
treeb57cd8d04f47395b66dee29e688dff1f171bcdcf /distbuild
parent2e87c9912e84409e8ac6eba43dc03593be06ca33 (diff)
downloadmorph-99b9efa9dd588afdc4f1e189380a4c71bbc7114e.tar.gz
Add handling for new messages to BuildController
There are two new messages: WorkerBuildStepAlreadyStarted tells the initiator that the artifact they want to build is already being built, e.g. 'eglibc-misc is already building on 172.17.1.37:3434' WorkerBuildWaiting tells the initiator that the artifact they want to build can't be built yet because there aren't any workers free, e.g. 'Ready to build eglibc-misc: waiting for a worker to become available'
Diffstat (limited to 'distbuild')
-rw-r--r--distbuild/build_controller.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/distbuild/build_controller.py b/distbuild/build_controller.py
index da9e97c..3182897 100644
--- a/distbuild/build_controller.py
+++ b/distbuild/build_controller.py
@@ -93,7 +93,12 @@ class BuildStepStarted(object):
self.id = request_id
self.step_name = step_name
self.worker_name = worker_name
-
+
+class BuildStepAlreadyStarted(BuildStepStarted):
+
+ def __init__(self, request_id, step_name, worker_name):
+ super(BuildStepAlreadyStarted, self).__init__(
+ request_id, step_name, worker_name)
class BuildOutput(object):
@@ -206,6 +211,7 @@ class BuildController(distbuild.StateMachine):
# specific to WorkerConnection instances that our currently
# building for us, but the state machines are not intended to
# behave that way).
+
('building', distbuild.WorkerConnection,
distbuild.WorkerBuildStepStarted, 'building',
self._maybe_relay_build_step_started),
@@ -216,6 +222,12 @@ class BuildController(distbuild.StateMachine):
distbuild.WorkerBuildCaching, 'building',
self._maybe_relay_build_caching),
('building', distbuild.WorkerConnection,
+ distbuild.WorkerBuildStepAlreadyStarted, 'building',
+ self._maybe_relay_build_step_already_started),
+ ('building', distbuild.WorkerConnection,
+ distbuild.WorkerBuildWaiting, 'building',
+ self._maybe_relay_build_waiting_for_worker),
+ ('building', distbuild.WorkerConnection,
distbuild.WorkerBuildFinished, 'building',
self._maybe_check_result_and_queue_more_builds),
('building', distbuild.WorkerConnection,
@@ -438,6 +450,21 @@ class BuildController(distbuild.StateMachine):
cancel = BuildCancel(disconnect.id)
self.mainloop.queue_event(BuildController, cancel)
+ def _maybe_relay_build_waiting_for_worker(self, event_source, event):
+ if event.initiator_id != self._request['id']:
+ return # not for us
+
+ artifact = self._find_artifact(event.artifact_cache_key)
+ if artifact is None:
+ # This is not the event you are looking for.
+ return
+
+ progress = BuildProgress(
+ self._request['id'],
+ 'Ready to build %s: waiting for a worker to become available'
+ % artifact.name)
+ self.mainloop.queue_event(BuildController, progress)
+
def _maybe_relay_build_step_started(self, event_source, event):
distbuild.crash_point()
if event.initiator_id != self._request['id']:
@@ -456,6 +483,18 @@ class BuildController(distbuild.StateMachine):
self.mainloop.queue_event(BuildController, started)
logging.debug('BC: emitted %s' % repr(started))
+ def _maybe_relay_build_step_already_started(self, event_source, event):
+ if event.initiator_id != self._request['id']:
+ return # not for us
+
+ artifact = self._find_artifact(event.artifact_cache_key)
+
+ logging.debug('BC: got build step already started: %s' % artifact.name)
+ started = BuildStepAlreadyStarted(
+ self._request['id'], build_step_name(artifact), event.worker_name)
+ self.mainloop.queue_event(BuildController, started)
+ logging.debug('BC: emitted %s' % repr(started))
+
def _maybe_relay_build_output(self, event_source, event):
distbuild.crash_point()
if event.msg['id'] != self._request['id']: