Skip to content

Commit

Permalink
Added possibility of setting rt logging info in catchall
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Nilsson committed Sep 19, 2024
1 parent a6acee8 commit 5685d2a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.2.5
3.8.2.6
20 changes: 17 additions & 3 deletions pilot/control/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,21 @@ def extract_error_info(error: str) -> (int, str):
return error_code, diagnostics


def get_rtlogging() -> str:
def get_rtlogging(catchall: str) -> str:
"""
Return the proper rtlogging value from the experiment specific plug-in or the config file.
Return the proper rtlogging value from PQ.catchall, the experiment specific plug-in or the config file.
:param catchall: catchall field from queuedata (str)
:return: rtlogging (str).
"""
if catchall:
_rtlogging = findall(r'logging=([^,]+)', catchall)
if _rtlogging and ";" in _rtlogging[0]:
logger.info(f"found rtlogging in catchall: {_rtlogging[0]}")
return _rtlogging[0]

rtlogging = None

pilot_user = os.environ.get('PILOT_USER', 'generic').lower()
try:
user = __import__(f'pilot.user.{pilot_user}.common', globals(), locals(), [pilot_user], 0)
Expand Down Expand Up @@ -419,7 +427,13 @@ def get_logging_info(job: JobData, args: object) -> dict:
info_dic['logname'] = args.realtime_logname if args.realtime_logname else "pilot-log"
logserver = args.realtime_logging_server if args.realtime_logging_server else ""

info = findall(r'(\S+)\;(\S+)\:\/\/(\S+)\:(\d+)', get_rtlogging())
try:
catchall = job.infosys.queuedata.catchall
except Exception as exc:
logger.warning(f'exception caught: {exc}')
catchall = ""

info = findall(r'(\S+)\;(\S+)\:\/\/(\S+)\:(\d+)', get_rtlogging(catchall))
if not logserver and not info:
logger.warning(f"not enough info available for activating real-time logging (info='{info}', logserver='{logserver}')")
return {}
Expand Down
2 changes: 1 addition & 1 deletion pilot/util/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
RELEASE = '3' # released number should be fixed at 3 for Pilot 3
VERSION = '8' # version number is '1' for first release, '0' until then, increased for bigger updates
REVISION = '2' # revision number should be reset to '0' for every new version release, increased for small updates
BUILD = '5' # build number should be reset to '1' for every new development cycle
BUILD = '6' # build number should be reset to '1' for every new development cycle

SUCCESS = 0
FAILURE = 1
Expand Down
2 changes: 1 addition & 1 deletion pilot/util/realtimelogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(self, args: Any, info_dic: dict, workdir: str, secrets: str, level:
if workdir: # bypass pylint warning - keep workdir for possible future development
pass
if not info_dic:
logger.warning('info dictionary not set - add \'logging=type:protocol://host:port\' to PQ.catchall)')
logger.warning('info dictionary not set - add \'logging=type;protocol://host:port\' to PQ.catchall)')
RealTimeLogger.glogger = None
return

Expand Down

0 comments on commit 5685d2a

Please sign in to comment.