catch exceptions in subjobs so AI won't crash

This commit is contained in:
Darren Ranalli 2007-04-13 18:58:30 +00:00
parent c1ec8b0fb3
commit da6d5fc3b9

View File

@ -320,6 +320,7 @@ class FindContainers(Job):
self._id2ref[contId] = objRef
def run(self):
try:
while True:
# yield up here instead of at the end, since we skip back to the
# top of the while loop from various points
@ -477,6 +478,12 @@ class FindContainers(Job):
del childName
del child
continue
except Exception, e:
print 'FindContainers job caught exception: %s' % e
if __dev__:
#raise e
pass
yield Job.done
class CheckContainers(Job):
"""
@ -499,6 +506,7 @@ class CheckContainers(Job):
return Job.Priorities.Normal
def run(self):
try:
self._leakDetector._index2containerId2len[self._index] = {}
ids = self._leakDetector.getContainerIds()
# record the current len of each container
@ -542,6 +550,7 @@ class CheckContainers(Job):
self._leakDetector._index2containerId2len[self._index][id] = cLen
# compare the current len of each container to past lens
if self._index > 0:
oashdfjkahsdf
idx2id2len = self._leakDetector._index2containerId2len
for id in idx2id2len[self._index]:
yield None
@ -610,6 +619,11 @@ class CheckContainers(Job):
self.notify.info('sending notification...')
yield None
messenger.send(self._leakDetector.getLeakEvent(), [container, name])
except Exception, e:
print 'CheckContainers job caught exception: %s' % e
if __dev__:
#raise e
pass
yield Job.Done
class PruneContainerRefs(Job):
@ -631,6 +645,7 @@ class PruneContainerRefs(Job):
return Job.Priorities.Normal
def run(self):
try:
ids = self._leakDetector.getContainerIds()
for id in ids:
yield None
@ -641,6 +656,11 @@ class PruneContainerRefs(Job):
except:
# reference is invalid, remove it
self._leakDetector.removeContainerById(id)
except Exception, e:
print 'PruneContainerRefs job caught exception: %s' % e
if __dev__:
#raise e
pass
yield Job.Done
class ContainerLeakDetector(Job):