From 3a5a8be75825db9700fa99b14b0396637e5e5cbe Mon Sep 17 00:00:00 2001 From: Alexander Veit <53857412+alexander-veit@users.noreply.github.com> Date: Tue, 6 Aug 2024 11:03:39 -0400 Subject: [PATCH] Add safeguard for parsing top command (#409) --- CHANGELOG.rst | 6 ++++++ pyproject.toml | 2 +- tibanna/top.py | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2dcbf23c..73b5526f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,12 @@ Change Log ========== +5.4.2 +===== + +* Safeguard against unexpected output from top command + + 5.4.1 ===== diff --git a/pyproject.toml b/pyproject.toml index 3b529388..55d6e95c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tibanna" -version = "5.4.1" +version = "5.4.2" description = "Tibanna runs portable pipelines (in CWL/WDL) on the AWS Cloud." authors = ["4DN-DCIC Team "] license = "MIT" diff --git a/tibanna/top.py b/tibanna/top.py index efb5aaca..2a90a42c 100644 --- a/tibanna/top.py +++ b/tibanna/top.py @@ -1,4 +1,7 @@ import datetime +from . import create_logger + +logger = create_logger(__name__) class Top(object): @@ -100,7 +103,11 @@ def parse_contents(self, contents): if is_in_table: if timestamp not in self.processes: self.processes[timestamp] = [] - process = Process(line) + try: + process = Process(line) + except: + logger.info(f"Could not process line from top command: {line}") + continue if not self.should_skip_process(process): self.processes[timestamp].append(Process(line))