Also delete the job key when expiring a job

Otherwise, we can't requeue the job
This commit is contained in:
Joseph Schorr 2017-10-11 15:55:35 -04:00
parent fdcf8dbdbc
commit ddb1ed7441

View file

@ -170,6 +170,13 @@ class EphemeralBuilderManager(BaseManager):
got_lock = yield From(self._take_etcd_atomic_lock('job-expired', build_job.build_uuid,
execution_id))
if got_lock:
try:
# Clean up the bookkeeping for the job.
yield From(self._etcd_client.delete(self._etcd_job_key(build_job)))
except (KeyError, etcd.EtcdKeyError):
logger.debug('Could not delete job key %s; might have been removed already',
build_job.build_uuid)
logger.error('[BUILD INTERNAL ERROR] Build ID: %s. Exec name: %s. Exec ID: %s',
build_job.build_uuid, executor_name, execution_id)
yield From(self.job_complete_callback(build_job, BuildJobResult.INCOMPLETE, executor_name,