From edd9a03af5bebc77cc4468b2169bfc379b9759d8 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 1 Dec 2015 12:24:17 -0500 Subject: [PATCH] Catch additional key not found exception Fixes #806 --- buildman/manager/ephemeral.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/buildman/manager/ephemeral.py b/buildman/manager/ephemeral.py index eb5dd13f7..91ac753b2 100644 --- a/buildman/manager/ephemeral.py +++ b/buildman/manager/ephemeral.py @@ -413,7 +413,13 @@ class EphemeralBuilderManager(BaseManager): def job_heartbeat(self, build_job): # Extend the deadline in etcd job_key = self._etcd_job_key(build_job) - build_job_metadata_response = yield From(self._etcd_client.read(job_key)) + + try: + build_job_metadata_response = yield From(self._etcd_client.read(job_key)) + except (KeyError, etcd.EtcdKeyError): + logger.error('Job %s not longer exists in etcd', build_job.job_details['build_uuid']) + return + build_job_metadata = json.loads(build_job_metadata_response.value) max_expiration = datetime.utcfromtimestamp(build_job_metadata['max_expiration'])