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

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, service, prefix, type)
 __getattr__ (self, name)
 __setattr__ (self, key, value)
 __str__ (self)

Protected Attributes

 _service = service
 _prefix = prefix
 _type = type
dict _props = {}

Detailed Description

Standalone Private Tool Configuration

This class is used to mimic the behaviour of Athena tool configurable
classes. To be able to set the properties of private tools used by
dual-use services in a way that's valid for both Athena and EventLoop.

Definition at line 261 of file AsgServiceConfig.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Constructor & Destructor Documentation

◆ __init__()

python.AsgServiceConfig.PrivateToolConfig.__init__ ( self,
service,
prefix,
type )
Constructor for an private tool configuration object

Definition at line 269 of file AsgServiceConfig.py.

269 def __init__( self, service, prefix, type ):
270 """Constructor for an private tool configuration object
271 """
272
273 self._service = service
274 self._prefix = prefix
275 self._type = type
276 self._props = {}
277
278 pass
279

Member Function Documentation

◆ __getattr__()

python.AsgServiceConfig.PrivateToolConfig.__getattr__ ( self,
name )
Get a previously set property value from the configuration

This function allows us to retrieve the value of a tool property that
was already set for an service's private tool, to possibly use it in
some configuration decisions in the Python code itself.

Keyword arguments:
  name -- The name of the property

Definition at line 280 of file AsgServiceConfig.py.

280 def __getattr__( self, name ):
281 """Get a previously set property value from the configuration
282
283 This function allows us to retrieve the value of a tool property that
284 was already set for an service's private tool, to possibly use it in
285 some configuration decisions in the Python code itself.
286
287 Keyword arguments:
288 name -- The name of the property
289 """
290
291 # Fail if the property was not (yet) set:
292 if not name in self._props:
293 raise AttributeError( 'Property "%s" was not set on "%s/%s.%s"' %
294 ( name, self._service.type(),
295 self._service.name(), self._prefix ) )
296
297 # Return the property value:
298 return self._props[ name ]
299

◆ __setattr__()

python.AsgServiceConfig.PrivateToolConfig.__setattr__ ( self,
key,
value )
Set a tool property on an existing configuration object

This function allows us to set/override properties on a private tool
of an service configuration object. Allowing for the following syntax:

   service = ...
   service.Tool.IntProperty = 66
   service.Tool.FloatProperty = 3.141592
   service.Tool.StringProperty = "Foo"

Keyword arguments:
  key   -- The key/name of the property
  value -- The value to set for the property

Definition at line 300 of file AsgServiceConfig.py.

300 def __setattr__( self, key, value ):
301 """Set a tool property on an existing configuration object
302
303 This function allows us to set/override properties on a private tool
304 of an service configuration object. Allowing for the following syntax:
305
306 service = ...
307 service.Tool.IntProperty = 66
308 service.Tool.FloatProperty = 3.141592
309 service.Tool.StringProperty = "Foo"
310
311 Keyword arguments:
312 key -- The key/name of the property
313 value -- The value to set for the property
314 """
315
316 # Private variables should be set directly:
317 if key[ 0 ] == '_':
318 return super( PrivateToolConfig, self ).__setattr__( key, value )
319
320 # Construct the full name, used in the C++ code:
321 fullName = self._prefix + "." + key
322
323 # Set the property, and remember its value:
324 self._service.setPropertyFromString( fullName,
325 stringPropValue( value ) )
326 self._props[ key ] = copy.deepcopy( value )
327 pass
328

◆ __str__()

python.AsgServiceConfig.PrivateToolConfig.__str__ ( self)
Print the private tool configuration in a user friendly way

This is just to help with debugging configurations, allowing
the user to get a nice printout of their job configuration.

Definition at line 329 of file AsgServiceConfig.py.

329 def __str__( self ):
330 """Print the private tool configuration in a user friendly way
331
332 This is just to help with debugging configurations, allowing
333 the user to get a nice printout of their job configuration.
334 """
335
336 name = 'Private Tool %s/%s' % ( self._type, self._prefix )
337 result = ' \n'
338 result += AsgServiceConfig._printHeader( name )
339 result += '\n'
340 for key, value in sorted( self._props.items() ):
341 if isinstance( value, str ):
342 printedValue = "'%s'" % value
343 else:
344 printedValue = value
345 pass
346 result += "|- %s: %s\n" % ( key, indentBy( printedValue, "| " ) )
347 pass
348 result += AsgServiceConfig._printFooter( name )
349 return result
350

Member Data Documentation

◆ _prefix

python.AsgServiceConfig.PrivateToolConfig._prefix = prefix
protected

Definition at line 274 of file AsgServiceConfig.py.

◆ _props

dict python.AsgServiceConfig.PrivateToolConfig._props = {}
protected

Definition at line 276 of file AsgServiceConfig.py.

◆ _service

python.AsgServiceConfig.PrivateToolConfig._service = service
protected

Definition at line 273 of file AsgServiceConfig.py.

◆ _type

python.AsgServiceConfig.PrivateToolConfig._type = type
protected

Definition at line 275 of file AsgServiceConfig.py.


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