ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
python.PropSetterProxy.PropSetterProxy Class Reference
Inheritance diagram for python.PropSetterProxy.PropSetterProxy:
Collaboration diagram for python.PropSetterProxy.PropSetterProxy:

Public Member Functions

def __init__ (self, ca, path)
 
def __setattr__ (self, name, value)
 

Private Member Functions

def __findComponents (self, ca)
 

Private Attributes

 __path
 

Static Private Attributes

 __compPaths
 
 __scannedCA
 

Detailed Description

Definition at line 10 of file PropSetterProxy.py.

Constructor & Destructor Documentation

◆ __init__()

def python.PropSetterProxy.PropSetterProxy.__init__ (   self,
  ca,
  path 
)

Definition at line 14 of file PropSetterProxy.py.

14  def __init__(self, ca, path):
15  self.__path = path
16  self.__findComponents( ca )
17 

Member Function Documentation

◆ __findComponents()

def python.PropSetterProxy.PropSetterProxy.__findComponents (   self,
  ca 
)
private

Definition at line 42 of file PropSetterProxy.py.

42  def __findComponents(self, ca):
43  if ca is not PropSetterProxy.__scannedCA:
44  PropSetterProxy.__scannedCA = ca
45  PropSetterProxy.__compPaths = {}
46  def __add(path, comp):
47  if comp.getName() == "":
48  return
49  PropSetterProxy.__compPaths[ path ] = comp
50 
51 
52  for svc in ca._services:
53  PropSetterProxy.__compPaths['SvcMgr/'+svc.getFullJobOptName()] = svc
54  for t in ca._publicTools:
55  PropSetterProxy.__compPaths['ToolSvc/'+t.getFullJobOptName()] = t
56  for t in ca._conditionsAlgs:
57  PropSetterProxy.__compPaths[t.getFullJobOptName()] = t
58  if ca._privateTools:
59  for t in ca._privateTools:
60  PropSetterProxy.__compPaths[t.getFullJobOptName()] = t
61 
62  def __nestAlg(startpath, comp): # it actually dives inside the algorithms and (sub) tools
63  if comp.getName() == "":
64  return
65  for name, value in comp._descriptors.items():
66  if isinstance( value.cpp_type, ConfigurableAlgTool ) or isinstance( value.cpp_type, PrivateToolHandle ):
67  __add( startpath+"/"+name+"/"+value.getFullJobOptName(), value )
68  __nestAlg( startpath+"/"+name+"/"+value.getName(), value )
69  if isinstance( value.cpp_type, PrivateToolHandleArray):
70  for toolIndex,t in enumerate(value):
71  __add( startpath+"/"+name+"/"+t.getFullJobOptName(), t )
72  __nestAlg( startpath+"/"+name+"/"+t.getName(), value[toolIndex] )
73 
74 
75  def __nestSeq( startpath, seq ):
76  for c in seq.Members:
77  if isSequence(c):
78  __nestSeq( startpath+"/"+c.getName(), c )
79  else: # the algorithm or tool
80  __add( startpath+"/"+c.getFullJobOptName(), c )
81  __nestAlg( startpath+"/"+c.getFullJobOptName(), c )
82 
83  __nestSeq("", ca._sequence)
84 
85 
86 
87 
88 

◆ __setattr__()

def python.PropSetterProxy.PropSetterProxy.__setattr__ (   self,
  name,
  value 
)

Definition at line 18 of file PropSetterProxy.py.

18  def __setattr__(self, name, value):
19  if name.startswith("_PropSetterProxy"):
20  return super(PropSetterProxy, self).__setattr__(name, value)
21 
22  if name != "OutputLevel":
23  msg.error("The foreach_component is a debugging feature and should not be used in production jobs, remove it before committing to the repository, proceeding to set the properties now" )
24 
25  import fnmatch
26  for component_path, component in PropSetterProxy.__compPaths.items():
27  if fnmatch.fnmatch( component_path, self.__path ):
28  if name in component._descriptors:
29  try:
30  setattr( component, name, value )
31  msg.info( "Set property: %s to value %s of component %s because it matched %s ",
32  name, str(value), component_path, self.__path )
33  except Exception as ex:
34  msg.warning( "Failed to set property: %s to value %s of component %s because it matched %s, reason: %s",
35  name, str(value), component_path, self.__path, str(ex) )
36  pass
37  else:
38  msg.warning( "No such property: %s in component %s, tried to set it because it matched %s",
39  name, component_path, self.__path )
40 
41 

Member Data Documentation

◆ __compPaths

python.PropSetterProxy.PropSetterProxy.__compPaths
staticprivate

Definition at line 11 of file PropSetterProxy.py.

◆ __path

python.PropSetterProxy.PropSetterProxy.__path
private

Definition at line 15 of file PropSetterProxy.py.

◆ __scannedCA

python.PropSetterProxy.PropSetterProxy.__scannedCA
staticprivate

Definition at line 12 of file PropSetterProxy.py.


The documentation for this class was generated from the following file:
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
python.CFElements.isSequence
def isSequence(obj)
Definition: CFElements.py:96
python.PyAthenaComps.__setattr__
__setattr__
Definition: PyAthenaComps.py:41