ATLAS Offline Software
Functions | Variables
python.trfExeStepTools Namespace Reference

Functions

def commonExecutorStepName (name)
 
def loadSplitConfig (config)
 
def getTotalExecutorSteps (executor, argdict=None)
 
def getExecutorStepEventCounts (executor, argdict=None)
 

Variables

 executorStepSuffix
 

Function Documentation

◆ commonExecutorStepName()

def python.trfExeStepTools.commonExecutorStepName (   name)
Remove executor step suffix from executor name.

Definition at line 7 of file trfExeStepTools.py.

7 def commonExecutorStepName(name):
8  """Remove executor step suffix from executor name."""
9  if executorStepSuffix in name:
10  name, _sep, _tail = name.rpartition(executorStepSuffix)
11  return name
12 
13 

◆ getExecutorStepEventCounts()

def python.trfExeStepTools.getExecutorStepEventCounts (   executor,
  argdict = None 
)
Get executor step event counts from executor config.

Definition at line 44 of file trfExeStepTools.py.

44 def getExecutorStepEventCounts(executor, argdict=None):
45  """Get executor step event counts from executor config."""
46  if not argdict:
47  argdict = executor.conf.argdict
48  if 'splitConfig' not in argdict:
49  return []
50 
51  maxEvents = argdict['maxEvents'].returnMyValue(exe=executor)
52  skipEvents = argdict['skipEvents'].returnMyValue(exe=executor)
53  splitConfig = argdict['splitConfig'].returnMyValue(exe=executor)
54  if not splitConfig:
55  return []
56 
57  steps, fractions = loadSplitConfig(splitConfig)
58 
59  if sum(fractions) != 1:
60  raise ValueError('Event fractions should total to 1!')
61 
62  counts = []
63  for i in range(len(fractions) - 1):
64  counts.append(round(maxEvents * fractions[i]))
65  counts.append(maxEvents - sum(counts))
66 
67  sums = []
68  for i in range(len(fractions)):
69  sums.append(skipEvents + sum(counts[:i]))
70 
71  return counts, sums

◆ getTotalExecutorSteps()

def python.trfExeStepTools.getTotalExecutorSteps (   executor,
  argdict = None 
)
Get total executor steps from executor.

Definition at line 29 of file trfExeStepTools.py.

29 def getTotalExecutorSteps(executor, argdict=None):
30  """Get total executor steps from executor."""
31  if not argdict:
32  argdict = executor.conf.argdict
33  if 'splitConfig' not in argdict:
34  return 0
35 
36  splitConfig = argdict['splitConfig'].returnMyValue(exe=executor)
37  if not splitConfig:
38  return 0
39 
40  steps, fractions = loadSplitConfig(splitConfig)
41  return steps
42 
43 

◆ loadSplitConfig()

def python.trfExeStepTools.loadSplitConfig (   config)
Load splitting configuration from file.

Definition at line 14 of file trfExeStepTools.py.

14 def loadSplitConfig(config):
15  """Load splitting configuration from file."""
16  parts = config.split('.')
17  if len(parts) < 2:
18  raise ValueError('Splitting config should be of the form Package.Module.Function or Package.Function if defined in __init__.py')
19 
20  function = parts[-1]
21  module = '.'.join(parts[:-1])
22 
23  from importlib import import_module
24  loaded_module = import_module(module)
25  function_def = getattr(loaded_module, function)
26  return function_def()
27 
28 

Variable Documentation

◆ executorStepSuffix

python.trfExeStepTools.executorStepSuffix

Definition at line 4 of file trfExeStepTools.py.

python.trfExeStepTools.loadSplitConfig
def loadSplitConfig(config)
Definition: trfExeStepTools.py:14
MuonGM::round
float round(const float toRound, const unsigned int decimals)
Definition: Mdt.cxx:27
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
python.trfExeStepTools.getTotalExecutorSteps
def getTotalExecutorSteps(executor, argdict=None)
Definition: trfExeStepTools.py:29
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.trfExeStepTools.getExecutorStepEventCounts
def getExecutorStepEventCounts(executor, argdict=None)
Definition: trfExeStepTools.py:44
python.trfExeStepTools.commonExecutorStepName
def commonExecutorStepName(name)
Definition: trfExeStepTools.py:7