Start catching etcd key errors as well.

This commit is contained in:
Jake Moshenko 2015-02-27 17:09:58 -05:00
parent a36266f758
commit 857c3e2959

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