diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-03-14 16:34:49 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-03-26 21:56:02 +0000 |
commit | 66d2165dc7a5e0183f83128170625ee19cf829e3 (patch) | |
tree | 604ef02cd252429bc703610642cff8dc38f3dc5c /distbuild | |
parent | 2632a9ac870177f6ec743fdd96e40dc1d71314a8 (diff) | |
download | morph-66d2165dc7a5e0183f83128170625ee19cf829e3.tar.gz |
Fix build controller
Whenever the controller finds a source artifact
it wants to build, it changes its state to BUILDING.
We build all a chunk's source artifacts in one go.
So for any chunk artifact, we change the state of
all chunk artifacts that are built from the
same source to BUILDING
Diffstat (limited to 'distbuild')
-rw-r--r-- | distbuild/build_controller.py | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/distbuild/build_controller.py b/distbuild/build_controller.py index a300f0d4..7849db17 100644 --- a/distbuild/build_controller.py +++ b/distbuild/build_controller.py @@ -278,8 +278,10 @@ class BuildController(distbuild.StateMachine): error_text = self._artifact_error.peek() if event.msg['exit'] != 0 or error_text: - notify_failure( - 'Problem with serialise-artifact: %s' % error_text) + notify_failure('Problem with serialise-artifact: %s' + % error_text) + + if event.msg['exit'] != 0: return text = self._artifact_data.peek() @@ -384,18 +386,32 @@ class BuildController(distbuild.StateMachine): ' depends on %s which is %s' % (dep.name, dep.state)) - ready = self._find_artifacts_that_are_ready_to_build() - if len(ready) == 0: - logging.debug('No new artifacts queued for building') + while True: + ready = self._find_artifacts_that_are_ready_to_build() + + if len(ready) == 0: + logging.debug('No new artifacts queued for building') + break + + artifact = ready[0] - for artifact in ready: logging.debug( 'Requesting worker-build of %s (%s)' % (artifact.name, artifact.cache_key)) request = distbuild.WorkerBuildRequest(artifact, self._request['id']) self.mainloop.queue_event(distbuild.WorkerBuildQueuer, request) + artifact.state = BUILDING + if artifact.source.morphology['kind'] == 'chunk': + # Chunk artifacts are not built independently + # so when we're building any chunk artifact + # we're also building all the chunk artifacts + # in this source + for a in ready: + if a.source == artifact.source: + a.state = BUILDING + def _notify_initiator_disconnected(self, event_source, disconnect): if disconnect.id == self._request['id']: @@ -479,6 +495,18 @@ class BuildController(distbuild.StateMachine): self.mainloop.queue_event(BuildController, finished) artifact.state = BUILT + + def set_state(a): + if a.source == artifact.source: + a.state = BUILT + + if artifact.source.morphology['kind'] == 'chunk': + # Building a single chunk artifact + # yields all chunk artifacts for the given source + # so we set the state of this source's artifacts + # to BUILT + map_build_graph(self._artifact, set_state) + self._queue_worker_builds(None, event) def _notify_build_failed(self, event_source, event): |