Skip to content

Commit

Permalink
Merge pull request #125 from PanDAWMS/next
Browse files Browse the repository at this point in the history
3.7.5.4
  • Loading branch information
PalNilsson committed May 8, 2024
2 parents 1dca4c9 + 01a8e8e commit dca3186
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.4.2
3.7.5.4
10 changes: 8 additions & 2 deletions pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -736,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:
Expand Down
4 changes: 2 additions & 2 deletions pilot/util/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '4' # build number should be reset to '1' for every new development cycle

SUCCESS = 0
FAILURE = 1
Expand Down
16 changes: 14 additions & 2 deletions pilot/util/cvmfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,19 @@ 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
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
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
Expand Down Expand Up @@ -103,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:
Expand Down

0 comments on commit dca3186

Please sign in to comment.