Merge pull request #1738 from coreos-inc/remove-pod

Remove pod fixes
This commit is contained in:
josephschorr 2016-08-16 16:45:36 -04:00 committed by GitHub
commit e987994654
2 changed files with 12 additions and 10 deletions

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)

View file

@ -408,6 +408,12 @@ class KubernetesExecutor(BuilderExecutor):
def stop_builder(self, builder_id):
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.
selectorString = "job-name=%s" % builder_id
try:
@ -415,12 +421,6 @@ class KubernetesExecutor(BuilderExecutor):
except:
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):
""" Adapted from http://codereview.stackexchange.com/a/17959