From 857c3e2959311385ecf509fd8aee1c26cd4c3898 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Fri, 27 Feb 2015 17:09:58 -0500 Subject: [PATCH] Start catching etcd key errors as well. --- buildman/manager/ephemeral.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/buildman/manager/ephemeral.py b/buildman/manager/ephemeral.py index ca57fdf98..9c99c6f64 100644 --- a/buildman/manager/ephemeral.py +++ b/buildman/manager/ephemeral.py @@ -144,7 +144,7 @@ class EphemeralBuilderManager(BaseManager): for realm in all_realms.children: if not realm.dir: self._register_realm(json.loads(realm.value)) - except KeyError: + except KeyError, etcd.KeyError: # no realms have been registered yet pass @@ -207,7 +207,7 @@ class EphemeralBuilderManager(BaseManager): try: building = yield From(self._etcd_client.read(self._etcd_builder_prefix, recursive=True)) workers_alive = sum(1 for child in building.children if not child.dir) - except KeyError: + except KeyError, etcd.KeyError: workers_alive = 0 except etcd.EtcdException: logger.exception('Exception when reading job count from etcd') @@ -238,7 +238,7 @@ class EphemeralBuilderManager(BaseManager): try: yield From(self._etcd_client.write(job_key, json.dumps(payload), prevExist=False, ttl=ttl)) - except KeyError: + except KeyError, etcd.KeyError: # The job was already taken by someone else, we are probably a retry logger.error('Job already exists in etcd, are timeouts misconfigured or is the queue broken?') raise Return(False) @@ -273,7 +273,7 @@ class EphemeralBuilderManager(BaseManager): try: yield From(self._etcd_client.write(self._etcd_realm_key(realm), realm_spec, prevExist=False, ttl=ttl)) - except KeyError: + except KeyError, etcd.KeyError: logger.error('Realm already exists in etcd. UUID collision or something is very very wrong.') raise Return(False) except etcd.EtcdException: @@ -293,7 +293,7 @@ class EphemeralBuilderManager(BaseManager): logger.debug('Sending build %s to newly ready component on realm %s', job.job_details['build_uuid'], build_component.builder_realm) yield From(build_component.start_build(job)) - except KeyError: + except KeyError, etcd.KeyError: logger.debug('Builder is asking for more work, but work already completed') def build_component_disposed(self, build_component, timed_out):