commit
e987994654
2 changed files with 12 additions and 10 deletions
|
@ -70,13 +70,15 @@ class BuildComponent(BaseComponent):
|
||||||
|
|
||||||
yield From(self._set_status(ComponentStatus.WAITING))
|
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
|
@trollius.coroutine
|
||||||
def start_build(self, build_job):
|
def start_build(self, build_job):
|
||||||
""" Starts a build. """
|
""" 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)',
|
logger.debug('Starting build for component %s (build %s, worker version: %s)',
|
||||||
self.builder_realm, build_job.repo_build.uuid, self._worker_version)
|
self.builder_realm, build_job.repo_build.uuid, self._worker_version)
|
||||||
|
|
||||||
|
|
|
@ -408,6 +408,12 @@ class KubernetesExecutor(BuilderExecutor):
|
||||||
def stop_builder(self, builder_id):
|
def stop_builder(self, builder_id):
|
||||||
pods_path = '/api/v1/namespaces/%s/pods' % self.namespace
|
pods_path = '/api/v1/namespaces/%s/pods' % self.namespace
|
||||||
|
|
||||||
|
# Delete the job itself.
|
||||||
|
try:
|
||||||
|
yield From(self._request('DELETE', self._job_path(builder_id)))
|
||||||
|
except:
|
||||||
|
logger.exception('Failed to send delete job call for job %s', builder_id)
|
||||||
|
|
||||||
# Delete the pod(s) for the job.
|
# Delete the pod(s) for the job.
|
||||||
selectorString = "job-name=%s" % builder_id
|
selectorString = "job-name=%s" % builder_id
|
||||||
try:
|
try:
|
||||||
|
@ -415,12 +421,6 @@ class KubernetesExecutor(BuilderExecutor):
|
||||||
except:
|
except:
|
||||||
logger.exception("Failed to send delete pod call for job %s", builder_id)
|
logger.exception("Failed to send delete pod call for job %s", builder_id)
|
||||||
|
|
||||||
# Delete the job itself.
|
|
||||||
try:
|
|
||||||
yield From(self._request('DELETE', self._job_path(builder_id)))
|
|
||||||
except:
|
|
||||||
logger.exception('Failed to send delete job call for job %s', builder_id)
|
|
||||||
|
|
||||||
|
|
||||||
class LogPipe(threading.Thread):
|
class LogPipe(threading.Thread):
|
||||||
""" Adapted from http://codereview.stackexchange.com/a/17959
|
""" Adapted from http://codereview.stackexchange.com/a/17959
|
||||||
|
|
Reference in a new issue