From 1d15c5a25ebddcfa123b6eca8024405b067533be Mon Sep 17 00:00:00 2001 From: Paul Nilsson Date: Fri, 4 Oct 2024 16:29:31 +0200 Subject: [PATCH] Implemented skipping OIDC token renewal if requested. Corrected request2() for debug mode --- PILOTVERSION | 2 +- pilot.py | 4 +++- pilot/control/monitor.py | 6 +++++- pilot/util/constants.py | 6 +++--- pilot/util/https.py | 7 ++++--- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/PILOTVERSION b/PILOTVERSION index 402ac81b..0ce40c12 100644 --- a/PILOTVERSION +++ b/PILOTVERSION @@ -1 +1 @@ -3.8.3.11 \ No newline at end of file +3.9.0.14 \ No newline at end of file diff --git a/pilot.py b/pilot.py index c9ce5fd6..ba9b5654 100755 --- a/pilot.py +++ b/pilot.py @@ -147,7 +147,9 @@ def main() -> int: return error.get_error_code() # update the OIDC token if necessary (after queuedata has been downloaded, since PQ.catchall can contain instruction to prevent token renewal) - if 'NO_TOKEN_RENEWAL' in infosys.queuedata.catchall: + if 'no_token_renewal' in infosys.queuedata.catchall and args.version_tag == "RC": + logger.info("OIDC token will not be renewed by the pilot") + else: update_local_oidc_token_info(args.url, args.port) # handle special CRIC variables via params diff --git a/pilot/control/monitor.py b/pilot/control/monitor.py index 54a2e20c..d1f7522a 100644 --- a/pilot/control/monitor.py +++ b/pilot/control/monitor.py @@ -103,10 +103,14 @@ def control(queues: namedtuple, traces: Any, args: object): # noqa: C901 break # check if the OIDC token needs to be refreshed - if tokendownloadchecktime and 'NO_TOKEN_RENEWAL' not in queuedata.catchall: + if tokendownloadchecktime: if int(time.time() - last_token_check) > tokendownloadchecktime: last_token_check = time.time() update_local_oidc_token_info(args.url, args.port) + #if 'no_token_renewal' in queuedata.catchall: + # logger.info("OIDC token will not be renewed by the pilot") + #else: + # update_local_oidc_token_info(args.url, args.port) # abort if kill signal arrived too long time ago, ie loop is stuck if args.kill_time and int(time.time()) - args.kill_time > MAX_KILL_WAIT_TIME: diff --git a/pilot/util/constants.py b/pilot/util/constants.py index ec79f3aa..b8145545 100644 --- a/pilot/util/constants.py +++ b/pilot/util/constants.py @@ -26,9 +26,9 @@ # Pilot version 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 = '3' # revision number should be reset to '0' for every new version release, increased for small updates -BUILD = '12' # build number should be reset to '1' for every new development cycle +VERSION = '9' # version number is '1' for first release, '0' until then, increased for bigger updates +REVISION = '0' # revision number should be reset to '0' for every new version release, increased for small updates +BUILD = '14' # build number should be reset to '1' for every new development cycle SUCCESS = 0 FAILURE = 1 diff --git a/pilot/util/https.py b/pilot/util/https.py index eb5336cf..70bcacc8 100644 --- a/pilot/util/https.py +++ b/pilot/util/https.py @@ -870,13 +870,14 @@ def request2(url: str = "", ret = "" else: if secure and isinstance(ret, str): - if ret.startswith('{') and ret.endswith('}'): + if ret == 'Succeeded': # this happens for sending modeOn (debug mode) + ret = {'StatusCode': '0'} + elif ret.startswith('{') and ret.endswith('}'): try: ret = json.loads(ret) except json.JSONDecodeError as e: logger.warning(f'failed to parse response: {e}') - else: - # For panda server interactions, the response should be in dictionary format + else: # response="StatusCode=_some number_" # Parse the query string into a dictionary query_dict = parse_qs(ret)