Skip to content

Commit

Permalink
Temporary add try excepts in unclassified events reader
Browse files Browse the repository at this point in the history
  • Loading branch information
verdigos committed Dec 4, 2024
1 parent aeb2552 commit 0e659a0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions indexer/event_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def read_batch(self):
def run(self):
try:
while True:
self.read_batch()
try:
self.read_batch()
except Exception as e:
logger.error(f'Error in UnclassifiedEventsReader: {e}')
except KeyboardInterrupt:
logger.info(f'Gracefully stopped in the UnclassifiedEventsReader')
except:
Expand Down Expand Up @@ -131,13 +134,16 @@ def mark_big_traces(self, tasks: list[tuple[str, int]]) -> list[str]:
return batch

def process_one_batch(self):
tasks = self.task_queue.get(True)
# logger.info(f'Worker #{self.id} accepted batch of {len(tasks)} tasks')
batch = self.mark_big_traces(tasks)
asyncio.get_event_loop().run_until_complete(process_trace_batch_async(batch))
total = len(tasks)
big_traces = total - len(batch)
self.result_queue.put((total - big_traces, big_traces, tasks))
try:
tasks = self.task_queue.get(True)
# logger.info(f'Worker #{self.id} accepted batch of {len(tasks)} tasks')
batch = self.mark_big_traces(tasks)
asyncio.get_event_loop().run_until_complete(process_trace_batch_async(batch))
total = len(tasks)
big_traces = total - len(batch)
self.result_queue.put((total - big_traces, big_traces, tasks))
except Exception as e:
logger.error(f'Error in EventClassifierWorker #{self.id}: {e}')
return

def run(self):
Expand Down

0 comments on commit 0e659a0

Please sign in to comment.