Adding in a delete of the etcd key for cancelled jobs.
This commit is contained in:
parent
2c637fe5ce
commit
8ec14ac3bd
1 changed files with 9 additions and 5 deletions
|
@ -490,11 +490,7 @@ class EphemeralBuilderManager(BaseManager):
|
||||||
logger.error('Could not start ephemeral worker for build %s', build_uuid)
|
logger.error('Could not start ephemeral worker for build %s', build_uuid)
|
||||||
|
|
||||||
# Delete the associated build job record.
|
# Delete the associated build job record.
|
||||||
try:
|
yield From(self.delete_etcd_key(job_key))
|
||||||
yield From(self._etcd_client.delete(job_key))
|
|
||||||
except (KeyError, etcd.EtcdKeyError):
|
|
||||||
logger.warning('Could not delete job key %s', job_key)
|
|
||||||
|
|
||||||
raise Return(False, self._ephemeral_api_timeout)
|
raise Return(False, self._ephemeral_api_timeout)
|
||||||
|
|
||||||
# Job was started!
|
# Job was started!
|
||||||
|
@ -731,4 +727,12 @@ class EphemeralBuilderManager(BaseManager):
|
||||||
raise Return(False)
|
raise Return(False)
|
||||||
got_lock = yield From(self._take_etcd_atomic_lock('job-cancelled', build_uuid, build_info.execution_id))
|
got_lock = yield From(self._take_etcd_atomic_lock('job-cancelled', build_uuid, build_info.execution_id))
|
||||||
if got_lock:
|
if got_lock:
|
||||||
|
yield From(self.delete_etcd_key(os.path.join(self._etcd_job_prefix, build_uuid)))
|
||||||
yield From(self.kill_builder_executor(build_uuid))
|
yield From(self.kill_builder_executor(build_uuid))
|
||||||
|
|
||||||
|
@coroutine
|
||||||
|
def delete_etcd_key(self, job_key):
|
||||||
|
try:
|
||||||
|
yield From(self._etcd_client.delete(job_key))
|
||||||
|
except (KeyError, etcd.EtcdKeyError):
|
||||||
|
logger.warning('Could not delete job key %s', job_key)
|
||||||
|
|
Reference in a new issue