From eb4c004bb37b03e2678e1b595f610359a43ed437 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Mon, 29 Sep 2025 10:10:47 +0100 Subject: [PATCH 1/3] More logs on dormancy check --- src/murfey/client/multigrid_control.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/murfey/client/multigrid_control.py b/src/murfey/client/multigrid_control.py index 23178b770..ca4dc8ee1 100644 --- a/src/murfey/client/multigrid_control.py +++ b/src/murfey/client/multigrid_control.py @@ -137,13 +137,17 @@ def is_ready_for_dormancy(self): for w in self._environment.watchers.values(): if w.is_safe_to_stop(): w.stop() - return ( - all(r._finalised for r in self.rsync_processes.values()) - and not any(a.thread.is_alive() for a in self.analysers.values()) - and not any( - w.thread.is_alive() for w in self._environment.watchers.values() - ) + rsyncers_finalised = all( + r._finalised for r in self.rsync_processes.values() + ) + analysers_alive = any(a.thread.is_alive() for a in self.analysers.values()) + watchers_alive = any( + w.thread.is_alive() for w in self._environment.watchers.values() + ) + log.debug( + f"Dormancy check: rsyncers {rsyncers_finalised}, analysers {not analysers_alive}, watchers {not watchers_alive}" ) + return rsyncers_finalised and not analysers_alive and not watchers_alive log.debug(f"Multigrid watcher for session {self.session_id} is still active") return False From df02a27e468d2a7ef17ec00025c75db1e6328b52 Mon Sep 17 00:00:00 2001 From: yxd92326 Date: Mon, 29 Sep 2025 10:12:04 +0100 Subject: [PATCH 2/3] Only skip files on completion if already skipped --- src/murfey/client/rsync.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/murfey/client/rsync.py b/src/murfey/client/rsync.py index 813f990bf..b0baa618a 100644 --- a/src/murfey/client/rsync.py +++ b/src/murfey/client/rsync.py @@ -79,6 +79,7 @@ def __init__( self._notify = notify self._finalised = False self._end_time = end_time + self._finalising = False self._skipped_files: List[Path] = [] @@ -199,7 +200,8 @@ def finalise( self.stop() self._remove_files = True self._notify = False - self._end_time = datetime.now() + self._end_time = None + self._finalising = True if thread: self.thread = threading.Thread( name=f"RSync finalisation {self._basepath}:{self._remote}", @@ -330,6 +332,9 @@ def _transfer(self, infiles: list[Path]) -> bool: ] self._skipped_files.extend(set(infiles).difference(set(files))) num_skipped_files = len(set(infiles).difference(set(files))) + elif self._finalising: + files = [f for f in infiles if f.is_file() and f not in self._skipped_files] + num_skipped_files = 0 else: files = [f for f in infiles if f.is_file()] num_skipped_files = 0 From 5df5af41d2d014d19a4ce6efd43e94e1acc1f275 Mon Sep 17 00:00:00 2001 From: Eu Pin Tien Date: Tue, 30 Sep 2025 13:43:00 +0100 Subject: [PATCH 3/3] Tidied up logs --- src/murfey/client/multigrid_control.py | 5 ++++- src/murfey/client/rsync.py | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/murfey/client/multigrid_control.py b/src/murfey/client/multigrid_control.py index ca4dc8ee1..7c5de07c6 100644 --- a/src/murfey/client/multigrid_control.py +++ b/src/murfey/client/multigrid_control.py @@ -145,7 +145,10 @@ def is_ready_for_dormancy(self): w.thread.is_alive() for w in self._environment.watchers.values() ) log.debug( - f"Dormancy check: rsyncers {rsyncers_finalised}, analysers {not analysers_alive}, watchers {not watchers_alive}" + "Dormancy check: \n" + f" rsyncers: {rsyncers_finalised} \n" + f" analysers: {not analysers_alive} \n" + f" watchers: {not watchers_alive}" ) return rsyncers_finalised and not analysers_alive and not watchers_alive log.debug(f"Multigrid watcher for session {self.session_id} is still active") diff --git a/src/murfey/client/rsync.py b/src/murfey/client/rsync.py index b0baa618a..b59321471 100644 --- a/src/murfey/client/rsync.py +++ b/src/murfey/client/rsync.py @@ -186,7 +186,7 @@ def stop(self): if self.thread.is_alive(): self.queue.put(None) self.thread.join() - logger.debug("RSync thread stop completed") + logger.debug("RSync thread successfully stopped") def request_stop(self): self._stopping = True @@ -286,7 +286,6 @@ def _process(self): continue self._stop_callback(self._basepath, explicit_stop=self._stopping) - logger.info("RSync thread finished") def _fake_transfer(self, files: list[Path]) -> bool: previously_transferred = self._files_transferred