From 6cc8ef97667260fa97f8c07e9ce7b3d51bf0f0e5 Mon Sep 17 00:00:00 2001 From: Neil Schroeder Date: Wed, 21 Jan 2026 14:21:50 -0600 Subject: [PATCH 1/2] fix storage monitor race condition --- lithops/monitor.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lithops/monitor.py b/lithops/monitor.py index ce68fa2b..0a77bd65 100644 --- a/lithops/monitor.py +++ b/lithops/monitor.py @@ -460,21 +460,17 @@ def run(self): previous_log = None log_time = 0 - while not self._all_ready(): - time.sleep(wait_dur_sec) - wait_dur_sec = self.monitoring_interval - log_time += wait_dur_sec - - if not self.should_run: - logger.debug(f'ExecutorID {self.executor_id} - Monitor stopped externally') - break - + while self.should_run: try: new_callids_done, previous_log, log_time = self._poll_and_process_job_status(previous_log, log_time) if new_callids_done: wait_dur_sec = self.monitoring_interval / 5 + else: + wait_dur_sec = self.monitoring_interval except Exception as e: logger.error(f'ExecutorID {self.executor_id} - Error during monitor: {e}', exc_info=True) + time.sleep(wait_dur_sec) + log_time += wait_dur_sec self._poll_and_process_job_status(previous_log, log_time) From df7124c6d96eccc84b04edcc9564f07dc50a306e Mon Sep 17 00:00:00 2001 From: Neil Schroeder Date: Thu, 22 Jan 2026 14:19:29 -0600 Subject: [PATCH 2/2] remove white space --- lithops/monitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lithops/monitor.py b/lithops/monitor.py index 0a77bd65..f2c70d08 100644 --- a/lithops/monitor.py +++ b/lithops/monitor.py @@ -465,7 +465,7 @@ def run(self): new_callids_done, previous_log, log_time = self._poll_and_process_job_status(previous_log, log_time) if new_callids_done: wait_dur_sec = self.monitoring_interval / 5 - else: + else: wait_dur_sec = self.monitoring_interval except Exception as e: logger.error(f'ExecutorID {self.executor_id} - Error during monitor: {e}', exc_info=True)