Removing realm key from etcd.
This commit is contained in:
parent
376578115f
commit
0c7a2e4645
2 changed files with 6 additions and 4 deletions
|
@ -727,12 +727,14 @@ 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(self._etcd_realm_key(build_info.component.builder_realm)))
|
||||||
|
yield From(self.delete_etcd_key(self._etcd_metric_key(build_info.component.builder_realm)))
|
||||||
yield From(self.delete_etcd_key(os.path.join(self._etcd_job_prefix, build_uuid)))
|
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
|
@coroutine
|
||||||
def delete_etcd_key(self, job_key):
|
def delete_etcd_key(self, etcd_key):
|
||||||
try:
|
try:
|
||||||
yield From(self._etcd_client.delete(job_key))
|
yield From(self._etcd_client.delete(etcd_key))
|
||||||
except (KeyError, etcd.EtcdKeyError):
|
except (KeyError, etcd.EtcdKeyError):
|
||||||
logger.warning('Could not delete job key %s', job_key)
|
logger.warning('Could not delete etcd key %s', etcd_key)
|
||||||
|
|
|
@ -30,7 +30,7 @@ class EtcdCanceller(object):
|
||||||
""" Writes etcd message to cancel build_uuid. """
|
""" Writes etcd message to cancel build_uuid. """
|
||||||
logger.info("Cancelling build %s".format(build_uuid))
|
logger.info("Cancelling build %s".format(build_uuid))
|
||||||
try:
|
try:
|
||||||
self._etcd_client.write("{}{}".format(self._cancel_prefix, build_uuid), build_uuid)
|
self._etcd_client.write("{}{}".format(self._cancel_prefix, build_uuid), build_uuid, ttl=0)
|
||||||
return True
|
return True
|
||||||
except etcd.EtcdException:
|
except etcd.EtcdException:
|
||||||
logger.exception("Failed to write to etcd client %s", build_uuid)
|
logger.exception("Failed to write to etcd client %s", build_uuid)
|
||||||
|
|
Reference in a new issue