From 5c68e52fce8d1c6aaa90d3c8dfc1f4abe300dfc5 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Fri, 27 Feb 2015 17:33:46 -0500 Subject: [PATCH] Really really fix the exception handling. --- 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 824854e94..bcba6deb8 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, etcd.KeyError): + except (KeyError, etcd.EtcdKeyError): # 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, etcd.KeyError): + except (KeyError, etcd.EtcdKeyError): 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, etcd.KeyError): + except (KeyError, etcd.EtcdKeyError): # 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, etcd.KeyError): + except (KeyError, etcd.EtcdKeyError): 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, etcd.KeyError): + except (KeyError, etcd.EtcdKeyError): logger.debug('Builder is asking for more work, but work already completed') def build_component_disposed(self, build_component, timed_out):