Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:17

0001 #!/usr/bin/env python
0002 # Licensed under the Apache License, Version 2.0 (the "License");
0003 # you may not use this file except in compliance with the License.
0004 # You may obtain a copy of the License at
0005 # http://www.apache.org/licenses/LICENSE-2.0
0006 #
0007 # Authors:
0008 # - Mario Lassnig, mario.lassnig@cern.ch, 2017
0009 # - Paul Nilsson, paul.nilsson@cern.ch, 2018-2021
0010 
0011 from os import environ
0012 
0013 # Pilot version
0014 RELEASE = '2'   # released number should be fixed at 2 for Pilot 2
0015 VERSION = '12'  # version number is '1' for first real Pilot 2 release, '0' until then, increased for bigger updates
0016 REVISION = '8'  # revision number should be reset to '1' for every new version release, increased for small updates
0017 BUILD = '1'     # build number should be reset to '1' for every new development cycle
0018 
0019 SUCCESS = 0
0020 FAILURE = 1
0021 
0022 ERRNO_NOJOBS = 20
0023 
0024 # Sorting order constants
0025 UTILITY_BEFORE_PAYLOAD = 1
0026 UTILITY_WITH_PAYLOAD = 2
0027 UTILITY_AFTER_PAYLOAD_STARTED = 3
0028 UTILITY_AFTER_PAYLOAD_STARTED2 = 4
0029 UTILITY_AFTER_PAYLOAD_FINISHED = 5
0030 UTILITY_AFTER_PAYLOAD_FINISHED2 = 6
0031 UTILITY_BEFORE_STAGEIN = 7
0032 UTILITY_WITH_STAGEIN = 8
0033 
0034 # Timing constants that allow for additional constants to be defined for values before the pilot is started, ie for
0035 # wrapper timing purposes.
0036 PILOT_START_TIME = 'PILOT_START_TIME'
0037 PILOT_MULTIJOB_START_TIME = 'PILOT_MULTIJOB_START_TIME'
0038 PILOT_PRE_GETJOB = 'PILOT_PRE_GETJOB'
0039 PILOT_POST_GETJOB = 'PILOT_POST_GETJOB'  # note: PILOT_POST_GETJOB corresponds to START_TIME in Pilot 1
0040 PILOT_PRE_SETUP = 'PILOT_PRE_SETUP'
0041 PILOT_POST_SETUP = 'PILOT_POST_SETUP'
0042 PILOT_PRE_STAGEIN = 'PILOT_PRE_STAGEIN'
0043 PILOT_POST_STAGEIN = 'PILOT_POST_STAGEIN'
0044 PILOT_PRE_PAYLOAD = 'PILOT_PRE_PAYLOAD'
0045 PILOT_POST_PAYLOAD = 'PILOT_POST_PAYLOAD'
0046 PILOT_PRE_STAGEOUT = 'PILOT_PRE_STAGEOUT'
0047 PILOT_POST_STAGEOUT = 'PILOT_POST_STAGEOUT'
0048 PILOT_PRE_FINAL_UPDATE = 'PILOT_PRE_FINAL_UPDATE'
0049 PILOT_POST_FINAL_UPDATE = 'PILOT_POST_FINAL_UPDATE'
0050 PILOT_END_TIME = 'PILOT_END_TIME'
0051 PILOT_KILL_SIGNAL = 'PILOT_KILL_SIGNAL'
0052 
0053 # Keep track of log transfers
0054 LOG_TRANSFER_NOT_DONE = 'NOT_DONE'
0055 LOG_TRANSFER_IN_PROGRESS = 'IN_PROGRESS'
0056 LOG_TRANSFER_DONE = 'DONE'
0057 LOG_TRANSFER_FAILED = 'FAILED'
0058 
0059 # Keep track of server updates
0060 SERVER_UPDATE_NOT_DONE = 'NOT_DONE'
0061 SERVER_UPDATE_RUNNING = 'RUNNING'
0062 SERVER_UPDATE_UPDATING = 'UPDATING_FINAL'
0063 SERVER_UPDATE_FINAL = 'DONE_FINAL'
0064 SERVER_UPDATE_TROUBLE = 'LOST_HEARTBEAT'
0065 
0066 # How long should the pilot wait before it should commit suicide after it has received a kill signal?
0067 MAX_KILL_WAIT_TIME = 120  # twenty minutes
0068 
0069 
0070 def get_pilot_version():
0071     """
0072     Return the current Pilot version string with the format <release>.<version>.<revision> (<build>).
0073     E.g. pilot_version = '2.1.3 (12)'
0074     :return: version string.
0075     """
0076 
0077     return '{release}.{version}.{revision} ({build})'.format(release=RELEASE,
0078                                                              version=VERSION,
0079                                                              revision=REVISION,
0080                                                              build=BUILD)
0081 
0082 
0083 def get_rucio_client_version():
0084     """
0085     Return the current Rucio client version string using the environmental variable ATLAS_LOCAL_RUCIOCLIENTS_VERSION.
0086     If the environmental variable is not set, then an empty string will be returned.
0087 
0088     :return: $ATLAS_LOCAL_RUCIOCLIENTS_VERSION (string).
0089     """
0090 
0091     return environ.get('ATLAS_LOCAL_RUCIOCLIENTS_VERSION', '')