ATLAS Offline Software
Loading...
Searching...
No Matches
python.PropSetterProxy.PropSetterProxy Class Reference
Inheritance diagram for python.PropSetterProxy.PropSetterProxy:
Collaboration diagram for python.PropSetterProxy.PropSetterProxy:

Public Types

typedef HLT::TypeInformation::for_each_type_c< typenameEDMLIST::map, my_functor, my_result<>, my_arg< HLT::TypeInformation::get_cont, CONTAINER > >::type result

Public Member Functions

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

Private Member Functions

 __findComponents (self, ca)

Private Attributes

 __path = path

Static Private Attributes

dict __compPaths = {}
 __scannedCA = None

Detailed Description

Definition at line 13 of file PropSetterProxy.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 17 of file PropSetterProxy.py.

17 def __init__(self, ca, path):
18 self.__path = path
19 self.__findComponents( ca )
20

Member Function Documentation

◆ __findComponents()

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

Definition at line 48 of file PropSetterProxy.py.

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

◆ __setattr__()

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

Definition at line 21 of file PropSetterProxy.py.

21 def __setattr__(self, name, value):
22 if name.startswith("_PropSetterProxy"):
23 return super(PropSetterProxy, self).__setattr__(name, value)
24
25 if name != "OutputLevel":
26 msg.error("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" )
27
28 matches = 0
29 for component_path, component in PropSetterProxy.__compPaths.items():
30 if fnmatch.fnmatch( component_path, self.__path ):
31 matches += 1
32 if name in component._descriptors:
33 try:
34 setattr( component, name, value )
35 msg.info( "Set property %s to %s for component %s because it matched '%s'",
36 name, value, component_path, self.__path )
37 except Exception as ex:
38 msg.warning( "Failed to set property %s to value %s for component %s: %s",
39 name, value, component_path, ex )
40 else:
41 msg.warning( "Property %s does not exist for component %s",
42 name, component_path )
43
44 if not matches:
45 msg.warning("No components found matching '%s'", self.__path)
46
47

Member Data Documentation

◆ __compPaths

dict python.PropSetterProxy.PropSetterProxy.__compPaths = {}
staticprivate

Definition at line 14 of file PropSetterProxy.py.

◆ __path

python.PropSetterProxy.PropSetterProxy.__path = path
private

Definition at line 18 of file PropSetterProxy.py.

◆ __scannedCA

python.PropSetterProxy.PropSetterProxy.__scannedCA = None
staticprivate

Definition at line 15 of file PropSetterProxy.py.


The documentation for this class was generated from the following file: