ATLAS Offline Software
Loading...
Searching...
No Matches
python.trfMTTools Namespace Reference

Functions

 detectAthenaMTThreads (argdict={}, currentSubstep='', legacyThreadingRelease=False)
 Detect if AthenaMT has been requested.

Variables

str __version__ = '$Revision'
 msg = logging.getLogger(__name__)

Function Documentation

◆ detectAthenaMTThreads()

python.trfMTTools.detectAthenaMTThreads ( argdict = {},
currentSubstep = '',
legacyThreadingRelease = False )

Detect if AthenaMT has been requested.

Parameters
argdictArgument dictionary, used to access athenaopts for the job
Returns
Two integers with the number of threads and number of concurrent events, N.B. 0 means non-MT serial mode

Definition at line 23 of file trfMTTools.py.

23def detectAthenaMTThreads(argdict = {}, currentSubstep = '', legacyThreadingRelease = False):
24 athenaMTThreads = 0
25 athenaConcurrentEvents = 0
26 currentSubstep = commonExecutorStepName(currentSubstep)
27
28 if legacyThreadingRelease:
29 return athenaMTThreads, athenaConcurrentEvents
30
31 # Try and detect if any AthenaMT has been enabled
32 try:
33 if 'athenaopts' in argdict:
34 for substep in argdict['athenaopts'].value:
35 if substep == 'all' or substep == currentSubstep:
36 threadArg = [opt.replace("--threads=", "") for opt in argdict['athenaopts'].value[substep] if '--threads' in opt]
37 if len(threadArg) == 0:
38 athenaMTThreads = 0
39 elif len(threadArg) == 1:
40 if 'multithreaded' in argdict and substep == 'all':
41 raise ValueError("Detected conflicting methods to configure AthenaMT: --multithreaded and --threads=N (via athenaopts). Only one method must be used")
42 athenaMTThreads = int(threadArg[0])
43 if athenaMTThreads < -1:
44 raise ValueError("--threads was set to a value less than -1")
45 else:
46 raise ValueError("--threads was set more than once in 'athenaopts'")
47 if athenaMTThreads > 0:
48 msg.info('AthenaMT detected from "threads" setting with {0} threads for substep {1}'.format(athenaMTThreads,substep))
49
50 concurrentEventsArg = [opt.replace("--concurrent-events=", "") for opt in argdict['athenaopts'].value[substep] if '--concurrent-events' in opt]
51 if len(concurrentEventsArg) == 1:
52 athenaConcurrentEvents = int(concurrentEventsArg[0])
53 if athenaConcurrentEvents < -1:
54 raise ValueError("--concurrent-events was set to a value less than -1")
55 msg.info('Custom concurrent event setting read from "concurrent-events" with {0} events for substep {1}'.format(athenaConcurrentEvents,substep))
56 else:
57 athenaConcurrentEvents = athenaMTThreads
58 if (athenaMTThreads == 0 and
59 'ATHENA_CORE_NUMBER' in os.environ and
60 'multithreaded' in argdict and argdict['multithreaded'].value):
61 athenaMTThreads = int(os.environ['ATHENA_CORE_NUMBER'])
62 if athenaMTThreads < -1:
63 raise ValueError("ATHENA_CORE_NUMBER value was less than -1")
64 msg.info('AthenaMT detected from ATHENA_CORE_NUMBER with {0} threads'.format(athenaMTThreads))
65 athenaConcurrentEvents = athenaMTThreads
66 except ValueError as errMsg:
67 myError = 'Problem discovering AthenaMT setup: {0}'.format(errMsg)
68 raise trfExceptions.TransformExecutionException(trfExit.nameToCode('TRF_EXEC_SETUP_FAIL'), myError)
69
70 return athenaMTThreads, athenaConcurrentEvents

Variable Documentation

◆ __version__

str python.trfMTTools.__version__ = '$Revision'
private

Definition at line 8 of file trfMTTools.py.

◆ msg

python.trfMTTools.msg = logging.getLogger(__name__)

Definition at line 13 of file trfMTTools.py.