summaryrefslogtreecommitdiff
path: root/distbuild/build_controller.py
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-05-07 17:12:56 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-05-12 13:18:22 +0000
commiteda5cb29d0200ee55c0ed50d2afe1a17dbd7577a (patch)
tree277ad825b27568bc801ee7353eadfed7a7d75369 /distbuild/build_controller.py
parenteb9e43d4ffe992cd66945a7d7fa2feb00ee49473 (diff)
downloadmorph-eda5cb29d0200ee55c0ed50d2afe1a17dbd7577a.tar.gz
Explain how to cancel a distbuild
Cancelling a distbuild with ctrl+c no longer cancels the build itself. This commit adds some output explaining what should be done to cancel the build as well as the local process. This commit also fixes a bug where the BuildStarted event would be sent each time a chunk finished building, since it was being sent in _queue_worker_builds. This is fixed by adding a new function to be called when the build graph annotation is complete which sends BuildStarted and then calls _queue_worker_builds, which no longer sends the BuildStarted event. Change-Id: I26ddea2c9080887f449e87004411ddffe4e583b7
Diffstat (limited to 'distbuild/build_controller.py')
-rw-r--r--distbuild/build_controller.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/distbuild/build_controller.py b/distbuild/build_controller.py
index 3a099b82..9b934da6 100644
--- a/distbuild/build_controller.py
+++ b/distbuild/build_controller.py
@@ -252,7 +252,7 @@ class BuildController(distbuild.StateMachine):
'annotating', self._maybe_handle_cache_response),
('annotating', self, BuildFailed, None, None),
('annotating', self, _Annotated, 'building',
- self._queue_worker_builds),
+ self._start_building),
('annotating', distbuild.InitiatorConnection,
distbuild.CancelRequest, 'annotating',
self._maybe_notify_build_cancelled),
@@ -478,23 +478,32 @@ class BuildController(distbuild.StateMachine):
self._components)
return [a for a in artifacts if is_ready_to_build(a)]
- def _queue_worker_builds(self, event_source, event):
- distbuild.crash_point()
-
+ def _build_complete(self):
if not self._components:
if self._artifact.state == BUILT:
logging.info('Requested artifact is built')
self.mainloop.queue_event(self, _Built())
- return
-
+ return True
else:
if not any(c.state != BUILT for c in self._components):
logging.info('Requested components are built')
self.mainloop.queue_event(self, _Built())
- return
+ return True
+ return False
+
+ def _start_building(self, event_source, event):
+ if self._build_complete():
+ return
self.mainloop.queue_event(BuildController,
BuildStarted(self._request['id']))
+ self._queue_worker_builds(event_source, event)
+
+ def _queue_worker_builds(self, event_source, event):
+ distbuild.crash_point()
+
+ if self._build_complete():
+ return
logging.debug('Queuing more worker-builds to run')
if self.debug_graph_state: