diff options
author | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-04-10 15:29:06 +0100 |
---|---|---|
committer | Richard Ipsum <richardipsum@fastmail.co.uk> | 2015-04-29 16:11:14 +0000 |
commit | 4941d1dd806d1751b1ac0f7a695ec2b6dce93ba0 (patch) | |
tree | 0f39b69358e9af9066b9d2dbc2ceffe4eebb7cf2 /distbuild/build_controller.py | |
parent | 84096556ea54d4af236f1fe5f7ccf61c1343016f (diff) | |
download | morph-4941d1dd806d1751b1ac0f7a695ec2b6dce93ba0.tar.gz |
distbuild: Add distbuild status command
Adds a command to get the status of all recently ran distbuilds
for a given server (e.g. Running, Finished, Failed, Cancelled),
so as to tell if a build running via distbuild-start has finished
or otherwise exited without going through the server's log files
Change-Id: I5ce9fe54ae7b1bd8fe3e0d629f615042be8827ed
Diffstat (limited to 'distbuild/build_controller.py')
-rw-r--r-- | distbuild/build_controller.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/distbuild/build_controller.py b/distbuild/build_controller.py index d879ffea..e38b25b7 100644 --- a/distbuild/build_controller.py +++ b/distbuild/build_controller.py @@ -183,6 +183,11 @@ class BuildController(distbuild.StateMachine): self.debug_transitions = False self.debug_graph_state = False self.allow_detach = build_request_message['allow_detach'] + self.build_info = { + 'id': build_request_message['id'], + 'morphology': build_request_message['morphology'], + 'status': 'Computing build graph' + } def __repr__(self): return '<BuildController at 0x%x, request-id %s>' % (id(self), @@ -535,6 +540,7 @@ class BuildController(distbuild.StateMachine): logging.debug("BuildController %r: initiator id %s cancelled", self, event.id) + self.build_info['status'] = 'Cancelled' cancel_pending = distbuild.WorkerCancelPending(event.id) self.mainloop.queue_event(distbuild.WorkerBuildQueuer, cancel_pending) @@ -553,6 +559,7 @@ class BuildController(distbuild.StateMachine): # This is not the event you are looking for. return + self.build_info['status'] = 'Waiting for a worker to become available' progress = BuildProgress( self._request['id'], 'Ready to build %s: waiting for a worker to become available' @@ -573,6 +580,7 @@ class BuildController(distbuild.StateMachine): return logging.debug('BC: got build step started: %s' % artifact.name) + self.build_info['status'] = 'Building %s' % artifact.name started = BuildStepStarted( self._request['id'], build_step_name(artifact), event.worker_name) self.mainloop.queue_event(BuildController, started) @@ -585,6 +593,7 @@ class BuildController(distbuild.StateMachine): artifact = self._find_artifact(event.artifact_cache_key) logging.debug('BC: got build step already started: %s' % artifact.name) + self.build_info['status'] = 'Building %s' % artifact.name started = BuildStepAlreadyStarted( self._request['id'], build_step_name(artifact), event.worker_name) self.mainloop.queue_event(BuildController, started) @@ -692,6 +701,8 @@ class BuildController(distbuild.StateMachine): self.fail('Building failed for %s' % artifact.name) + self.build_info['status'] = 'Failed building %s' % artifact.name + # Cancel any jobs waiting to be executed, since there is no point # running them if this build has failed, it would just waste # resources @@ -711,6 +722,7 @@ class BuildController(distbuild.StateMachine): distbuild.crash_point() logging.debug('Notifying initiator of successful build') + self.build_info['status'] = 'Finished' baseurl = urlparse.urljoin( self._artifact_cache_server, '/1.0/artifacts') urls = [] |