From 00360be038d088821c6edcdcaba0186bcc8b8966 Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Wed, 4 Dec 2024 11:31:04 +0000 Subject: [PATCH 1/2] feat: Log task run errors at ERROR level --- task_processor/processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task_processor/processor.py b/task_processor/processor.py index c150e68..93d5436 100644 --- a/task_processor/processor.py +++ b/task_processor/processor.py @@ -99,7 +99,7 @@ def _run_task(task: typing.Union[Task, RecurringTask]) -> typing.Tuple[Task, Tas task_run.finished_at = timezone.now() task.mark_success() except Exception as e: - logger.warning( + logger.error( "Failed to execute task '%s'. Exception was: %s", task.task_identifier, str(e), From d471442b3dd73bf7ac3aa19efe4bda0bc68d53b9 Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Wed, 4 Dec 2024 11:50:37 +0000 Subject: [PATCH 2/2] fix test --- .../task_processor/test_unit_task_processor_processor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/task_processor/test_unit_task_processor_processor.py b/tests/unit/task_processor/test_unit_task_processor_processor.py index 985ec09..04826a3 100644 --- a/tests/unit/task_processor/test_unit_task_processor_processor.py +++ b/tests/unit/task_processor/test_unit_task_processor_processor.py @@ -240,9 +240,9 @@ def test_run_task_runs_task_and_creates_task_run_object_when_failure( assert len(caplog.records) == 3 - warning_log = caplog.records[0] - assert warning_log.levelname == "WARNING" - assert warning_log.message == ( + log_record = caplog.records[0] + assert log_record.levelname == "ERROR" + assert log_record.message == ( f"Failed to execute task '{task.task_identifier}'. Exception was: {msg}" )