ATLAS Offline Software
Classes | Functions
python.ComponentAccumulator Namespace Reference

Classes

class  ComponentAccumulator
 
class  ConfigurationError
 

Functions

def __exit ()
 
def printProperties (msg, c, nestLevel=0, printDefaults=False, onlyComponentsOnly=False)
 
def filterComponents (comps, onlyComponents=[])
 
def startInteractive (localVarDic)
 
def printInteractiveMsg_init ()
 
def printInteractiveMsg_run ()
 
def conf2toConfigurable (*args, **kwargs)
 
def CAtoGlobalWrapper (*args, **kwargs)
 
def appendCAtoAthena (*args, **kwargs)
 

Function Documentation

◆ __exit()

def python.ComponentAccumulator.__exit ( )
private

Definition at line 33 of file ComponentAccumulator.py.

33 def __exit():
34  ComponentAccumulator._checkUnmerged = False
35 atexit.register(__exit)
36 

◆ appendCAtoAthena()

def python.ComponentAccumulator.appendCAtoAthena ( args,
**  kwargs 
)

Definition at line 1266 of file ComponentAccumulator.py.

1266  def appendCAtoAthena(*args, **kwargs):
1267  raise RuntimeError("appendCAtoAthena cannot be called in a CA job")

◆ CAtoGlobalWrapper()

def python.ComponentAccumulator.CAtoGlobalWrapper ( args,
**  kwargs 
)

Definition at line 1264 of file ComponentAccumulator.py.

1264  def CAtoGlobalWrapper(*args, **kwargs):
1265  raise RuntimeError("CAtoGlobalWrapper cannot be called in a CA job")

◆ conf2toConfigurable()

def python.ComponentAccumulator.conf2toConfigurable ( args,
**  kwargs 
)

Definition at line 1262 of file ComponentAccumulator.py.

1262  def conf2toConfigurable(*args, **kwargs):
1263  raise RuntimeError("conf2toConfigurable cannot be called in a CA job")

◆ filterComponents()

def python.ComponentAccumulator.filterComponents (   comps,
  onlyComponents = [] 
)

Definition at line 79 of file ComponentAccumulator.py.

79 def filterComponents (comps, onlyComponents = []):
80  ret = []
81  for c in comps:
82  if not onlyComponents or c.getName() in onlyComponents:
83  ret.append((c, True))
84  elif c.getName()+'-' in onlyComponents:
85  ret.append((c, False))
86  return ret
87 
88 

◆ printInteractiveMsg_init()

def python.ComponentAccumulator.printInteractiveMsg_init ( )

Definition at line 1237 of file ComponentAccumulator.py.

1238  print("Interactive mode")
1239  print("\tThe ComponentAccumulator is known as 'self', you can inspect it but changes are not taken into account.")
1240  print("\tThe application is known as 'app' but not yet initialized.")
1241  print("\t^D will exit the interactive mode and athena will continue.")
1242  print("\texit() will terminate the program now.")
1243  return
1244 
1245 

◆ printInteractiveMsg_run()

def python.ComponentAccumulator.printInteractiveMsg_run ( )

Definition at line 1246 of file ComponentAccumulator.py.

1247  print("Interactive mode")
1248  print("\tThe application is known as 'app' and initialized.")
1249  print("\tYou can process N events with 'app.run(N)'.")
1250  print("\tStoreGate is accessible as 'sg'.")
1251  print("\t^D will exit the interactive mode and athena will finalize.")
1252  return
1253 
1254 
1255 # Make legacy support available in legacy jobs

◆ printProperties()

def python.ComponentAccumulator.printProperties (   msg,
  c,
  nestLevel = 0,
  printDefaults = False,
  onlyComponentsOnly = False 
)

Definition at line 37 of file ComponentAccumulator.py.

37 def printProperties(msg, c, nestLevel = 0, printDefaults=False, onlyComponentsOnly=False):
38  # Iterate in sorted order.
39  propnames= sorted(c._descriptors.keys())
40  for propname in propnames:
41 
42  if not printDefaults and not c.is_property_set(propname):
43  continue
44 
45  propval=getattr(c,propname)
46  # Ignore empty lists
47 
48  if isinstance(propval,(GaudiConfig2.semantics._ListHelper,
49  GaudiConfig2.semantics._DictHelper,
50  GaudiConfig2.semantics._SetHelper)) and propval.data is None:
51  continue
52  # Printing EvtStore could be relevant for Views?
53  if not c.is_property_set(propname) and propname in ["DetStore","EvtStore", "AuditFinalize", "AuditInitialize", "AuditReinitialize", "AuditRestart", "AuditStart", "AuditStop", "AuditTools", "ExtraInputs", "ExtraOutputs"]:
54  continue
55 
56  if isinstance(propval, GaudiConfig2.Configurable):
57  msg.info("%s * %s: %s/%s", " "*nestLevel, propname, propval.__cpp_type__, propval.getName())
58  printProperties(msg, propval, nestLevel+3)
59  continue
60 
61  propstr = ""
62  if isinstance(propval, GaudiHandles.PublicToolHandleArray):
63  ths = [th.getName() for th in propval]
64  propstr = "PublicToolHandleArray([ {0} ])".format(', '.join(ths))
65  elif isinstance(propval, GaudiHandles.PrivateToolHandleArray):
66  msg.info( "%s * %s: PrivateToolHandleArray of size %s", " "*nestLevel, propname, len(propval))
67  for el in propval:
68  msg.info( "%s * %s/%s", " "*(nestLevel+3), el.__cpp_type__, el.getName())
69  printProperties(msg, el, nestLevel+6)
70  elif isinstance(propval, GaudiHandles.GaudiHandle): # Any other handle
71  propstr = "Handle( {0} )".format(propval.typeAndName)
72  elif not onlyComponentsOnly:
73  propstr = str(propval)
74  if propstr:
75  msg.info("%s * %s: %s", " "*nestLevel, propname, propstr)
76  return
77 
78 

◆ startInteractive()

def python.ComponentAccumulator.startInteractive (   localVarDic)
Setup and start a useful interactive session including auto-completion and history

Definition at line 1220 of file ComponentAccumulator.py.

1220 def startInteractive(localVarDic):
1221  """Setup and start a useful interactive session including auto-completion and history"""
1222  import code
1223 
1224  # collect all global and local variables
1225  vars = sys.modules['__main__'].__dict__
1226  vars.update(globals())
1227  vars.update(localVarDic)
1228 
1229  # configure the prompt
1230  from AthenaCommon.Interactive import configureInteractivePrompt
1232 
1233  # start the interpreter
1234  code.interact(local=vars)
1235 
1236 
vtune_athena.format
format
Definition: vtune_athena.py:14
python.ComponentAccumulator.appendCAtoAthena
def appendCAtoAthena(*args, **kwargs)
Definition: ComponentAccumulator.py:1266
python.ComponentAccumulator.CAtoGlobalWrapper
def CAtoGlobalWrapper(*args, **kwargs)
Definition: ComponentAccumulator.py:1264
python.ComponentAccumulator.conf2toConfigurable
def conf2toConfigurable(*args, **kwargs)
Definition: ComponentAccumulator.py:1262
python.ComponentAccumulator.__exit
def __exit()
Definition: ComponentAccumulator.py:33
python.Interactive.configureInteractivePrompt
def configureInteractivePrompt(completionDict=None)
Definition: Interactive.py:80
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.ComponentAccumulator.startInteractive
def startInteractive(localVarDic)
Definition: ComponentAccumulator.py:1220
python.ComponentAccumulator.printInteractiveMsg_run
def printInteractiveMsg_run()
Definition: ComponentAccumulator.py:1246
str
Definition: BTagTrackIpAccessor.cxx:11
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
python.ComponentAccumulator.printInteractiveMsg_init
def printInteractiveMsg_init()
Definition: ComponentAccumulator.py:1237
python.ComponentAccumulator.printProperties
def printProperties(msg, c, nestLevel=0, printDefaults=False, onlyComponentsOnly=False)
Definition: ComponentAccumulator.py:37
python.ComponentAccumulator.filterComponents
def filterComponents(comps, onlyComponents=[])
Definition: ComponentAccumulator.py:79