From fd5a152ecaf5c25fc08237bd5f2257e28d9b2857 Mon Sep 17 00:00:00 2001 From: Fabrice Le Goff <fabrice.le.goff@cern.ch> Date: Wed, 12 Sep 2018 15:24:47 +0200 Subject: [PATCH] critical log instead of crashing in case of deleted .COPYING file --- Script/CopyThread.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Script/CopyThread.py b/Script/CopyThread.py index 6409e2e..6ecd39b 100644 --- a/Script/CopyThread.py +++ b/Script/CopyThread.py @@ -359,8 +359,14 @@ class CopyThread(threading.Thread): self.logger.critical('No connection to Metadata database: database will not be updated for file %s', DataFile) ##### Copy successfull: rename .data.COPYING in .data.COPIED ##### - os.rename(DataFile + Constants.copying_ext, - DataFile + Constants.copied_ext) + try: + os.rename(DataFile + Constants.copying_ext, + DataFile + Constants.copied_ext) + except OSError as exc: + if exc.errno == errno.ENOENT: + self.logger.critical('error renaming %s: not present (deleted by external cause)', DataFile + Constants.copying_ext) + else: + raise exc if self.conf.DdmMonitoringEnabled: self.publishInDdmMonitoring( -- GitLab