Skip to content

Commit

Permalink
Implemented skipping OIDC token renewal if requested. Corrected reque…
Browse files Browse the repository at this point in the history
…st2() for debug mode
  • Loading branch information
Paul Nilsson committed Oct 4, 2024
1 parent 381c47d commit 1d15c5a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.8.3.11
3.9.0.14
4 changes: 3 additions & 1 deletion pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion pilot/control/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions pilot/util/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions pilot/util/https.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 1d15c5a

Please sign in to comment.