stats collate_worker catchall

This commit is contained in:
Greg Lange 2011-04-18 18:22:51 +00:00 committed by Tarmac
commit 3243e7f079
2 changed files with 6 additions and 5 deletions

View File

@ -553,7 +553,7 @@ def multiprocess_collate(processor_args, logs_to_process, worker_count):
except Queue.Empty:
time.sleep(.01)
else:
if not isinstance(data, BadFileDownload):
if not isinstance(data, Exception):
yield item, data
if not any(r.is_alive() for r in results) and out_queue.empty():
# all the workers are done and nothing is in the queue
@ -570,6 +570,8 @@ def collate_worker(processor_args, in_queue, out_queue):
break
try:
ret = p.process_one_file(*item)
except BadFileDownload, err:
except Exception, err:
item_string = '/'.join(item[1:])
p.logger.exception("Unable to process file '%s'" % (item_string))
ret = err
out_queue.put((item, ret))

View File

@ -342,7 +342,7 @@ use = egg:swift#proxy
def test_collate_worker_error(self):
def get_object_data(*a,**kw):
raise log_processor.BadFileDownload()
raise Exception()
orig_get_object_data = log_processor.LogProcessor.get_object_data
try:
log_processor.LogProcessor.get_object_data = get_object_data
@ -364,8 +364,7 @@ use = egg:swift#proxy
self.assertEquals(item, work_request)
# these only work for Py2.7+
#self.assertIsInstance(ret, log_processor.BadFileDownload)
self.assertTrue(isinstance(ret, log_processor.BadFileDownload),
type(ret))
self.assertTrue(isinstance(ret, Exception))
finally:
log_processor.LogProcessor.get_object_data = orig_get_object_data