Skip to content

Commit

Permalink
T2Processor: record exception provenance
Browse files Browse the repository at this point in the history
- Trouble doc includes process name
- Event doc records success (i.e. no exceptions)

This makes it easier to find T2 exceptions.
  • Loading branch information
jvansanten committed May 27, 2021
1 parent 0859466 commit 1fd6cb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ampel/t2/T2Processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def run(self, pre_check: bool = True) -> int:

# Process t2 docs until next() returns None (breaks condition below)
self._run = True
self._exception = False
while self._run:

# get t2 document (status is usually NEW or NEW_PRIO)
Expand All @@ -245,7 +246,7 @@ def run(self, pre_check: bool = True) -> int:
if garbage_collect:
gc.collect()

event_doc.update(logger, docs=self._doc_counter, run=run_id)
event_doc.update(logger, docs=self._doc_counter, run=run_id, success=not self._exception)

logger.flush()
self.t2_instances.clear()
Expand Down Expand Up @@ -834,12 +835,14 @@ def _processing_error(self,

info: Dict[str, Any] = {
**extra,
'process': self.process_name,
'run': t2_rec['run'],
'stock': t2_doc['stock'],
'doc': t2_doc
}

if exception:
self._exception = True
report_exception(
self._ampel_db, logger=logger,
exc=exception, info=info
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ampel-core"
version = "0.7.2"
version = "0.7.3"
description = "Asynchronous and Modular Platform with Execution Layers"
authors = [
"Valery Brinnel"
Expand Down

0 comments on commit 1fd6cb4

Please sign in to comment.