From: Michael Tremer Date: Mon, 24 Oct 2022 16:11:36 +0000 (+0000) Subject: jobs: Don't fail when we cannot tail the log X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3df6ca7690df3a6a92dbb3a7fe0eed97c0ccf0c;p=pbs.git jobs: Don't fail when we cannot tail the log Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index 72d0a874..8e74861d 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -445,8 +445,13 @@ class Job(base.DataObject): Tails the log file (i.e. returns the N last lines) """ # Open the log file - with await self.open_log() as f: - return await asyncio.to_thread(self._tail_log, f, limit) + try: + with await self.open_log() as f: + return await asyncio.to_thread(self._tail_log, f, limit) + + # Return nothing if the log could not be opened + except FileNotFoundError as e: + return [] def _tail_log(self, f, limit): # Create a new queue