Really really fix the exception handling.

This commit is contained in:
Jake Moshenko 2015-02-27 17:33:46 -05:00
parent cf5bc6f0be
commit 5c68e52fce

View file

@ -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):