From 34853d05a2135865c2aeaf4cfc252ba18e68a9c8 Mon Sep 17 00:00:00 2001 From: Max Kolomeychenko Date: Thu, 1 Feb 2024 16:06:46 +0000 Subject: [PATCH] need tests (#51) Co-authored-by: Maxim Kolomeychenko Co-authored-by: Nikolai Petukhov --- agent/worker/task_app.py | 5 +++++ agent/worker/task_dockerized.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/agent/worker/task_app.py b/agent/worker/task_app.py index 4d19eaa..6f8ff5e 100644 --- a/agent/worker/task_app.py +++ b/agent/worker/task_app.py @@ -721,6 +721,11 @@ def process_logs(self): def _process_line(log_line): # log_line = log_line.decode("utf-8") msg, res_log, lvl = self.parse_log_line(log_line) + if msg is None: + self.logger.warn( + "Received empty (none) message in log line, will be handled automatically" + ) + msg = "empty message" self._process_report(msg) output = self.call_event_function(res_log) diff --git a/agent/worker/task_dockerized.py b/agent/worker/task_dockerized.py index bcef579..bfb8ea1 100644 --- a/agent/worker/task_dockerized.py +++ b/agent/worker/task_dockerized.py @@ -347,6 +347,10 @@ def process_logs(self): self.logger.warn("No logs obtained from container.") # check if bug occurred def _process_report(self, log_msg: str): + if log_msg is None: + self.logger.warn("Received empty (none) message in process task report") + return + err_title, err_desc = None, None splits = log_msg.split(":")