Skip to content

Commit

Permalink
Merge pull request #132 from PalNilsson/next
Browse files Browse the repository at this point in the history
3.7.7.3
  • Loading branch information
PalNilsson authored Jun 12, 2024
2 parents 58519b2 + 5feb7ce commit 06a3363
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 108 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.6.8
3.7.7.3
2 changes: 2 additions & 0 deletions pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
PILOT_MULTIJOB_START_TIME,
)
from pilot.util.cvmfs import (
cvmfs_diagnostics,
is_cvmfs_available,
get_last_update
)
Expand Down Expand Up @@ -123,6 +124,7 @@ def main() -> int:
# check cvmfs if available
ec = check_cvmfs(logger)
if ec:
cvmfs_diagnostics()
return ec

if not args.rucio_host:
Expand Down
2 changes: 1 addition & 1 deletion pilot/eventservice/esprocess/esmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
# Authors:
# - Wen Guan, [email protected], 2017
# - Paul Nilsson, [email protected], 2023
# - Paul Nilsson, [email protected], 2023-24

"""Event Service manager to set up and run ESProcess."""

Expand Down
12 changes: 12 additions & 0 deletions pilot/user/atlas/cvmfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,15 @@ def get_last_update_file() -> str:
:return: last update file (str).
"""
return f'{get_cvmfs_base_path()}/sft.cern.ch/lcg/lastUpdate'


def get_cvmfs_diagnostics_commands() -> list:
"""
Return a list of commands to be used for CVMFS diagnostics.
:return: list of commands (list).
"""
return [
'cvmfs_config stat atlas.cern.ch',
f'attr -g revision {get_cvmfs_base_path()}/atlas.cern.ch'
]
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 = '6' # revision number should be reset to '0' for every new version release, increased for small updates
BUILD = '8' # build number should be reset to '1' for every new development cycle
REVISION = '7' # 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

SUCCESS = 0
FAILURE = 1
Expand Down
25 changes: 25 additions & 0 deletions pilot/util/cvmfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import time
import types

from pilot.util.container import execute

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -149,3 +151,26 @@ def extract_timestamp(filename: str) -> int:
signal.alarm(0) # Disable the alarm

return timestamp


def cvmfs_diagnostics():
"""Run cvmfs_diagnostics."""
pilot_user = os.environ.get('PILOT_USER', 'generic').lower()
user = __import__(f'pilot.user.{pilot_user}.cvmfs', globals(), locals(), [pilot_user], 0)
try:
cmds = user.get_cvmfs_diagnostics_commands()
except AttributeError:
logger.warning('get_cvmfs_diagnostics_commands not defined in user cvmfs module')
return

if cmds:
for cmd in cmds:
timeout = 60
logger.info(f'running cvmfs diagnostics command using timeout={timeout}s')
exit_code, stdout, stderr = execute(cmd, timeout=timeout)
if exit_code == 0:
logger.info(f'cvmfs diagnostics completed successfully:\n{stdout}')
else:
logger.warning(f'cvmfs diagnostics failed: {stderr}')
else:
logger.warning('cvmfs diagnostics commands not defined in user cvmfs module')
Loading

0 comments on commit 06a3363

Please sign in to comment.