From 6fbd70786e68f03a30d27a928b4daec51c987667 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Thu, 29 Feb 2024 13:51:09 +0200 Subject: [PATCH] Add protection for truncate() call --- clearml_agent/commands/worker.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clearml_agent/commands/worker.py b/clearml_agent/commands/worker.py index 902e5f8..c9dff26 100644 --- a/clearml_agent/commands/worker.py +++ b/clearml_agent/commands/worker.py @@ -1883,8 +1883,13 @@ class Worker(ServiceCommandSection): pos = f.tell() else: # buffered - read everything and truncate - f.truncate(0) - pos = 0 + # noinspection PyBroadException + try: + f.truncate(0) + pos = 0 + except Exception: + pos = f.tell() + # skip the previously printed lines, blines = binary_text.split(b'\n') if binary_text else [] if not blines: