Add extra check to ensure a build cannot be started without on_ready called

This commit is contained in:
Joseph Schorr 2016-08-16 16:38:48 -04:00
parent 5e1a117ff3
commit 433b157531

View file

@ -70,13 +70,15 @@ class BuildComponent(BaseComponent):
yield From(self._set_status(ComponentStatus.WAITING))
def is_ready(self):
""" Determines whether a build component is ready to begin a build. """
return self._component_status == ComponentStatus.RUNNING
@trollius.coroutine
def start_build(self, build_job):
""" Starts a build. """
if self._component_status != ComponentStatus.RUNNING:
logger.debug('Could not start build for component %s (build %s, worker version: %s): %s',
self.builder_realm, build_job.repo_build.uuid, self._worker_version,
self._component_status)
raise Return()
logger.debug('Starting build for component %s (build %s, worker version: %s)',
self.builder_realm, build_job.repo_build.uuid, self._worker_version)