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

Public Member Functions

def __init__ (self, service, prefix, type)
 
def __getattr__ (self, name)
 
def __setattr__ (self, key, value)
 
def __str__ (self)
 

Private Attributes

 _service
 
 _prefix
 
 _type
 
 _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.

Constructor & Destructor Documentation

◆ __init__()

def 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__()

def 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__()

def 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__()

def 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
private

Definition at line 274 of file AsgServiceConfig.py.

◆ _props

python.AsgServiceConfig.PrivateToolConfig._props
private

Definition at line 276 of file AsgServiceConfig.py.

◆ _service

python.AsgServiceConfig.PrivateToolConfig._service
private

Definition at line 273 of file AsgServiceConfig.py.

◆ _type

python.AsgServiceConfig.PrivateToolConfig._type
private

Definition at line 275 of file AsgServiceConfig.py.


The documentation for this class was generated from the following file:
python.AsgServiceConfig.stringPropValue
def stringPropValue(value)
Definition: AsgServiceConfig.py:354
python.AsgServiceConfig.indentBy
def indentBy(propValue, indent)
Definition: AsgServiceConfig.py:364
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.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
python.PyAthenaComps.__setattr__
__setattr__
Definition: PyAthenaComps.py:39