From 87fc47285e0ec77e10b10c7ae5799739f0cc5b78 Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Tue, 7 May 2024 17:27:17 +0200 Subject: [PATCH 1/6] New version --- PILOTVERSION | 2 +- pilot/util/constants.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PILOTVERSION b/PILOTVERSION index fe6e3d7f..d5b7a88a 100644 --- a/PILOTVERSION +++ b/PILOTVERSION @@ -1 +1 @@ -3.7.4.2 \ No newline at end of file +3.7.5.1 \ No newline at end of file diff --git a/pilot/util/constants.py b/pilot/util/constants.py index da65ded0..93e48306 100644 --- a/pilot/util/constants.py +++ b/pilot/util/constants.py @@ -27,8 +27,8 @@ # Pilot version RELEASE = '3' # released number should be fixed at 3 for Pilot 3 VERSION = '7' # version number is '1' for first release, '0' until then, increased for bigger updates -REVISION = '4' # revision number should be reset to '0' for every new version release, increased for small updates -BUILD = '2' # build number should be reset to '1' for every new development cycle +REVISION = '5' # revision number should be reset to '0' for every new version release, increased for small updates +BUILD = '1' # build number should be reset to '1' for every new development cycle SUCCESS = 0 FAILURE = 1 From e0eb3b6aceec5f9760a48b057b8212888406aa37 Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Tue, 7 May 2024 17:32:33 +0200 Subject: [PATCH 2/6] Corrected cvmfs check --- pilot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pilot.py b/pilot.py index 915e3c8c..a71856c2 100755 --- a/pilot.py +++ b/pilot.py @@ -121,13 +121,19 @@ def main() -> int: ) # note: assuming IPv6, fallback in place # check cvmfs if available - if is_cvmfs_available() is True: # ignore None, False is handled in function + is_available = is_cvmfs_available() + if is_available is None: + pass # ignore this case + elif is_available is True: timestamp = get_last_update() if timestamp and timestamp > 0: logger.info('CVMFS has been validated') else: logger.warning('CVMFS is not responding - aborting pilot') return errors.CVMFSISNOTALIVE + else: + logger.warning('CVMFS is not alive - aborting pilot') + return errors.CVMFSISNOTALIVE if not args.rucio_host: args.rucio_host = config.Rucio.host From 07510cfdcb175d2e48089999efdd248af88603c7 Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Tue, 7 May 2024 18:18:35 +0200 Subject: [PATCH 3/6] Added file open attempt --- PILOTVERSION | 2 +- pilot/util/constants.py | 2 +- pilot/util/cvmfs.py | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/PILOTVERSION b/PILOTVERSION index d5b7a88a..2ab2e51d 100644 --- a/PILOTVERSION +++ b/PILOTVERSION @@ -1 +1 @@ -3.7.5.1 \ No newline at end of file +3.7.5.2 \ No newline at end of file diff --git a/pilot/util/constants.py b/pilot/util/constants.py index 93e48306..a6769de1 100644 --- a/pilot/util/constants.py +++ b/pilot/util/constants.py @@ -28,7 +28,7 @@ RELEASE = '3' # released number should be fixed at 3 for Pilot 3 VERSION = '7' # version number is '1' for first release, '0' until then, increased for bigger updates REVISION = '5' # revision number should be reset to '0' for every new version release, increased for small updates -BUILD = '1' # build number should be reset to '1' for every new development cycle +BUILD = '2' # build number should be reset to '1' for every new development cycle SUCCESS = 0 FAILURE = 1 diff --git a/pilot/util/cvmfs.py b/pilot/util/cvmfs.py index a869d528..93d41c67 100644 --- a/pilot/util/cvmfs.py +++ b/pilot/util/cvmfs.py @@ -65,7 +65,16 @@ def is_cvmfs_available() -> bool or None: if get_base_path: mount_point = mount_point.replace('CVMFS_BASE', get_base_path()) if os.path.exists(mount_point): - logger.debug(f'CVMFS is available at {mount_point}') + # verify that the file can be opened + try: + with open(mount_point, 'r'): + pass + except Exception as exc: + logger.warning(f'failed to open file {mount_point}: {exc}') + found_bad_mount_point = True + break + else: + logger.info(f'CVMFS is available at {mount_point} (and could be opened)') else: logger.warning(f'CVMFS is not available at {mount_point}') found_bad_mount_point = True From a76df9a0c35478211777993528d9780ebb3c1f58 Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Tue, 7 May 2024 18:38:47 +0200 Subject: [PATCH 4/6] Skipping directories --- PILOTVERSION | 2 +- pilot/util/constants.py | 2 +- pilot/util/cvmfs.py | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PILOTVERSION b/PILOTVERSION index 2ab2e51d..644c2e98 100644 --- a/PILOTVERSION +++ b/PILOTVERSION @@ -1 +1 @@ -3.7.5.2 \ No newline at end of file +3.7.5.3 \ No newline at end of file diff --git a/pilot/util/constants.py b/pilot/util/constants.py index a6769de1..b9fc58d4 100644 --- a/pilot/util/constants.py +++ b/pilot/util/constants.py @@ -28,7 +28,7 @@ RELEASE = '3' # released number should be fixed at 3 for Pilot 3 VERSION = '7' # version number is '1' for first release, '0' until then, increased for bigger updates REVISION = '5' # revision number should be reset to '0' for every new version release, increased for small updates -BUILD = '2' # build number should be reset to '1' for every new development cycle +BUILD = '3' # build number should be reset to '1' for every new development cycle SUCCESS = 0 FAILURE = 1 diff --git a/pilot/util/cvmfs.py b/pilot/util/cvmfs.py index 93d41c67..d2e310f8 100644 --- a/pilot/util/cvmfs.py +++ b/pilot/util/cvmfs.py @@ -66,6 +66,9 @@ def is_cvmfs_available() -> bool or None: mount_point = mount_point.replace('CVMFS_BASE', get_base_path()) if os.path.exists(mount_point): # verify that the file can be opened + if 'lastUpdate' not in mount_point: # skip directories + logger.info(f'CVMFS is available at {mount_point}') + continue try: with open(mount_point, 'r'): pass From 5f8d9471570991d0d9196f4df4872d44d32e84dd Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Tue, 7 May 2024 18:48:53 +0200 Subject: [PATCH 5/6] Update --- pilot/util/cvmfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilot/util/cvmfs.py b/pilot/util/cvmfs.py index d2e310f8..b2075d42 100644 --- a/pilot/util/cvmfs.py +++ b/pilot/util/cvmfs.py @@ -115,7 +115,7 @@ def get_last_update() -> int: now = int(time.time()) logger.info(f'last cvmfs update on ' f'{time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(timestamp))} ' - f'{now - timestamp} seconds ago {timestamp}()') + f'{now - timestamp} seconds ago ({timestamp})') else: logger.warning(f'last update file does not exist: {last_update_file}') else: From a579bb9c2eff79b16c005556b6c9697920f3fc54 Mon Sep 17 00:00:00 2001 From: PalNilsson Date: Wed, 8 May 2024 09:33:00 +0200 Subject: [PATCH 6/6] Improved exception handling --- PILOTVERSION | 2 +- pilot.py | 2 +- pilot/util/constants.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PILOTVERSION b/PILOTVERSION index 644c2e98..b53bc731 100644 --- a/PILOTVERSION +++ b/PILOTVERSION @@ -1 +1 @@ -3.7.5.3 \ No newline at end of file +3.7.5.4 \ No newline at end of file diff --git a/pilot.py b/pilot.py index a71856c2..ebd356b3 100755 --- a/pilot.py +++ b/pilot.py @@ -742,7 +742,7 @@ def get_proper_exit_code() -> (int, int): """ try: exitcode = trace.pilot["error_code"] - except KeyError: + except (KeyError, AttributeError): exitcode = trace logging.debug(f"trace was not a class, trace={trace}") else: diff --git a/pilot/util/constants.py b/pilot/util/constants.py index b9fc58d4..6053694d 100644 --- a/pilot/util/constants.py +++ b/pilot/util/constants.py @@ -28,7 +28,7 @@ RELEASE = '3' # released number should be fixed at 3 for Pilot 3 VERSION = '7' # version number is '1' for first release, '0' until then, increased for bigger updates REVISION = '5' # revision number should be reset to '0' for every new version release, increased for small updates -BUILD = '3' # build number should be reset to '1' for every new development cycle +BUILD = '4' # build number should be reset to '1' for every new development cycle SUCCESS = 0 FAILURE = 1