From 0c7a2e46450731f963aa19d306ab4b9ad2f273f9 Mon Sep 17 00:00:00 2001 From: Charlton Austin Date: Fri, 2 Dec 2016 11:13:17 -0500 Subject: [PATCH] Removing realm key from etcd. --- buildman/manager/ephemeral.py | 8 +++++--- buildman/manager/etcd_canceller.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/buildman/manager/ephemeral.py b/buildman/manager/ephemeral.py index 392c5889d..2270f5fd5 100644 --- a/buildman/manager/ephemeral.py +++ b/buildman/manager/ephemeral.py @@ -727,12 +727,14 @@ class EphemeralBuilderManager(BaseManager): raise Return(False) got_lock = yield From(self._take_etcd_atomic_lock('job-cancelled', build_uuid, build_info.execution_id)) 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.kill_builder_executor(build_uuid)) @coroutine - def delete_etcd_key(self, job_key): + def delete_etcd_key(self, etcd_key): try: - yield From(self._etcd_client.delete(job_key)) + yield From(self._etcd_client.delete(etcd_key)) except (KeyError, etcd.EtcdKeyError): - logger.warning('Could not delete job key %s', job_key) + logger.warning('Could not delete etcd key %s', etcd_key) diff --git a/buildman/manager/etcd_canceller.py b/buildman/manager/etcd_canceller.py index dccde1949..648ff6e72 100644 --- a/buildman/manager/etcd_canceller.py +++ b/buildman/manager/etcd_canceller.py @@ -30,7 +30,7 @@ class EtcdCanceller(object): """ Writes etcd message to cancel build_uuid. """ logger.info("Cancelling build %s".format(build_uuid)) 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 except etcd.EtcdException: logger.exception("Failed to write to etcd client %s", build_uuid)