Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.7.5.4 #124

Merged
merged 6 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading