From 6c8389cd48ba07a6c498a84b36b0b5ed37fd419c Mon Sep 17 00:00:00 2001 From: Fabrice Le Goff <fabrice.le.goff@cern.ch> Date: Thu, 12 May 2022 17:50:17 +0200 Subject: [PATCH] take ctime of .PROBL file as reference for retrying --- Script/cs/Threads/ManagerThread.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Script/cs/Threads/ManagerThread.py b/Script/cs/Threads/ManagerThread.py index 614e7d0..105ef02 100644 --- a/Script/cs/Threads/ManagerThread.py +++ b/Script/cs/Threads/ManagerThread.py @@ -276,18 +276,23 @@ class ManagerThread(threading.Thread): self.logger.debug('problematic file: %s; check if time to retry transferring', filename) with self.problematic_lock: if filename not in self.problematic: - self.problematic[filename] = (time(), 0) + try: + problematic_since = os.path.getctime(filename + Constants.problematic_ext) + except FileNotFoundError as exc: + self.logger.warning(exc) + problematic_since = time() + self.problematic[filename] = (problematic_since, 0) self.logger.debug('retry #1: %s', filename) return True (timestamp, nretry) = self.problematic.get(filename) # Try to copy the file again only if the timeout is expired retry_timeout = self.conf.ProblDelay * math.exp(self.conf.ProblScalingFactor * nretry) - nretry += 1 if (time() - timestamp) > retry_timeout: + self.logger.debug('retry %d: %s', nretry, filename) + nretry += 1 with self.problematic_lock: self.problematic[filename] = [time(), nretry] - self.logger.debug('retry %d: %s', nretry-1, filename) # Inform the user if we cannot copy the file and the retry time # limit has been reached -- GitLab