Commit 83dc4901 authored by Michał Woźniak's avatar Michał Woźniak

WIP: #7 queue.put() improvement, and a bit better debug output around BailException

parent 9ad9888e
......@@ -37,7 +37,7 @@ def excinit(self, *args, **kwargs):
try:
_run(*args, **kwargs)
except BailException:
logging.debug('BailException caught')
logging.debug('BailException caught in a subthread')
self.run = run
# we're monkey patching a module imported in a module we import
# this is absolutely haram
......@@ -292,6 +292,9 @@ class EmptyQueue(object):
def join(self):
raise BailException()
def emptyput(arg):
raise BailException()
# monkey-patching fatal_error() so that we can handle ingestion errors gracefully
#
# first, define a replacement
......@@ -319,6 +322,7 @@ def non_fatal_error(error, filename=None, lineno=None):
logging.debug('fatal_error(): not fatal')
for r in import_logs.Recorder.recorders:
logging.debug('fatal_error(): in for')
r.queue.put = emptyput
r.queue.task_done()
while not r.queue.empty():
logging.debug('fatal_error(): in while')
......@@ -452,6 +456,7 @@ while True:
parser.parse(f)
import_logs.Recorder.wait_empty()
except BailException:
logging.debug('BailException caught in main thread')
pass
logging.debug("after import_logs.Recorder.wait_empty()")
if hasattr(import_logs.Recorder, "exc"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment