ATLAS Offline Software
Loading...
Searching...
No Matches
python.trfArgClasses.argSubstepSteering Class Reference

Special argument class to hold steering information. More...

Inheritance diagram for python.trfArgClasses.argSubstepSteering:
Collaboration diagram for python.trfArgClasses.argSubstepSteering:

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

 value (self)
 dumpvalue (self)
 prodsysDescription (self)
 value (self, value)
 returnMyValue (self, name=None, substep=None, first=False, exe=None)
 Return the value of this substep arg for an executor with the given parameters.
 isRunarg (self)
 Return runarg status.
 name (self)
 Name getter.
 name (self, value)
 Name setter.
 __str__ (self)
 String conversion of our value.
 __repr__ (self)
 Repr conversion of our value.
 __eq__ (self, other)
 Comparison is based on value attribute.
 __nq__ (self, other)
 __lt__ (self, other)
 __gt__ (self, other)

Static Public Attributes

dict steeringAlises

Protected Member Functions

 _parseSetterString (self, string)
 _parseSteeringString (self, ivalue)
 _parseStringAsSubstep (self, string)
 Parse a string for substep:value format.

Protected Attributes

list _dumpvalue = [""]
 _defaultSubstep = defaultSubstep
 _separator = separator
 _runarg = runarg
 _name = name
 _value = value

Detailed Description

Special argument class to hold steering information.

Definition at line 2331 of file trfArgClasses.py.

Member Typedef Documentation

◆ result

Definition at line 90 of file EDM_MasterSearch.h.

Member Function Documentation

◆ __eq__()

python.trfArgClasses.argument.__eq__ ( self,
other )
inherited

Comparison is based on value attribute.

Definition at line 161 of file trfArgClasses.py.

161 def __eq__(self,other):
162 return self.value == other.value
163

◆ __gt__()

python.trfArgClasses.argument.__gt__ ( self,
other )
inherited

Definition at line 170 of file trfArgClasses.py.

170 def __gt__(self, other):
171 return self.value > other.value
172

◆ __lt__()

python.trfArgClasses.argument.__lt__ ( self,
other )
inherited

Definition at line 167 of file trfArgClasses.py.

167 def __lt__(self, other):
168 return self.value < other.value
169

◆ __nq__()

python.trfArgClasses.argument.__nq__ ( self,
other )
inherited

Definition at line 164 of file trfArgClasses.py.

164 def __nq__(self, other):
165 return self.value != other.value
166

◆ __repr__()

python.trfArgClasses.argument.__repr__ ( self)
inherited

Repr conversion of our value.

Definition at line 157 of file trfArgClasses.py.

157 def __repr__(self):
158 return repr(self.value)
159

◆ __str__()

python.trfArgClasses.argument.__str__ ( self)
inherited

String conversion of our value.

Definition at line 153 of file trfArgClasses.py.

153 def __str__(self):
154 return '{0}: Value {1} (isRunArg={2})'.format(self.__class__.__name__, self._value, self._runarg)
155

◆ _parseSetterString()

python.trfArgClasses.argSubstepSteering._parseSetterString ( self,
string )
protected

Definition at line 2418 of file trfArgClasses.py.

2418 def _parseSetterString(self, string):
2419 if string in argSubstepSteering.steeringAlises:
2420 return argSubstepSteering.steeringAlises[string]
2421

◆ _parseSteeringString()

python.trfArgClasses.argSubstepSteering._parseSteeringString ( self,
ivalue )
protected

Definition at line 2422 of file trfArgClasses.py.

2422 def _parseSteeringString(self, ivalue):
2423 retvalue = []
2424 for subvalue in ivalue.split(','):
2425 matchedParts = re.match(r'(in|out)(\+|\-)([A-Z_]+)$', subvalue)
2426 if not matchedParts:
2427 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2428 'Failed to convert string {0!s} to argSubstepSteering'.format(subvalue))
2429 retvalue.append((matchedParts.group(1), matchedParts.group(2), matchedParts.group(3)))
2430 return retvalue
2431
2432

◆ _parseStringAsSubstep()

python.trfArgClasses.argSubstep._parseStringAsSubstep ( self,
string )
protectedinherited

Parse a string for substep:value format.

If the string matches the substep specifier regexp then we return the two parts; if not then the substep is returned as self._defaultSubstep, with the entire string passed back as the value

Parameters
stringThe string which should be parsed

Reimplemented in python.trfArgClasses.argSubstepList.

Definition at line 2001 of file trfArgClasses.py.

2001 def _parseStringAsSubstep(self, string):
2002 subStepMatch = re.match(r'([a-zA-Z0-9,]+)' + self._separator + r'(.*)', string)
2003 subStepList = []
2004 if subStepMatch:
2005 subStep = subStepMatch.group(1).split(',')
2006 subStepValue = subStepMatch.group(2)
2007 else:
2008 subStep = [self._defaultSubstep]
2009 subStepValue = string
2010 msg.debug('Parsed {0} as substep {1}, argument {2}'.format(string, subStep, subStepValue))
2011 for step in subStep:
2012 subStepList.append((step, subStepValue))
2013 return subStepList
2014
2015
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177

◆ dumpvalue()

python.trfArgClasses.argSubstepSteering.dumpvalue ( self)

Definition at line 2360 of file trfArgClasses.py.

2360 def dumpvalue(self):
2361 return self._dumpvalue
2362

◆ isRunarg()

python.trfArgClasses.argument.isRunarg ( self)
inherited

Return runarg status.

Definition at line 134 of file trfArgClasses.py.

134 def isRunarg(self):
135 return self._runarg
136

◆ name() [1/2]

python.trfArgClasses.argument.name ( self)
inherited

Name getter.

Reimplemented in python.trfArgClasses.argFile, and python.trfArgClasses.argFile.

Definition at line 139 of file trfArgClasses.py.

139 def name(self):
140 return self._name
141

◆ name() [2/2]

python.trfArgClasses.argument.name ( self,
value )
inherited

Name setter.

Reimplemented in python.trfArgClasses.argFile, and python.trfArgClasses.argFile.

Definition at line 144 of file trfArgClasses.py.

144 def name(self, value):
145 self._name = value
146

◆ prodsysDescription()

python.trfArgClasses.argSubstepSteering.prodsysDescription ( self)

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2364 of file trfArgClasses.py.

2364 def prodsysDescription(self):
2365 desc = {'type': 'substep', 'substeptype': 'steering', 'listtype': 'str', 'separator': self._separator,
2366 'default': self._defaultSubstep}
2367 return desc
2368

◆ returnMyValue()

python.trfArgClasses.argSubstep.returnMyValue ( self,
name = None,
substep = None,
first = False,
exe = None )
inherited

Return the value of this substep arg for an executor with the given parameters.

Parameters
nameExecutor name
substepExecutor substep nickname
firstBoolean flag set true if this is the first executor in the chain
exeExecutor instance, from which 'name', 'substep' and 'first' can be taken.

Definition at line 2021 of file trfArgClasses.py.

2021 def returnMyValue(self, name=None, substep=None, first=False, exe=None):
2022 if exe:
2023 name = exe.name
2024 substep = exe.substep
2025 first = exe.conf.firstExecutor
2026
2027 name = commonExecutorStepName(name)
2028
2029 value = None
2030
2031 if name in self._value:
2032 value = self._value[name]
2033 elif substep in self._value:
2034 value = self._value[substep]
2035 elif first and 'first' in self._value:
2036 value = self._value['first']
2037 elif 'default' in self._value:
2038 value = self._value['default']
2039
2040
2048 if 'all' in self._value:
2049 if value is None:
2050 value = self._value['all']
2051 elif isinstance(value, list):
2052 value = self._value['all'] + value
2053
2054 msg.debug('From substep argument {myvalue} picked value "{value}" for {name}, {substep}, first={first}'.format(myvalue=self._value, value=value, name=name, substep=substep, first=first))
2055
2056 return value
2057

◆ value() [1/2]

python.trfArgClasses.argSubstepSteering.value ( self)
Note
We have a default of None here, but all derived classes should definitely have their own value setter and translate this value to something sensible for their underlying value type. N.B. As most argument classes use this default constructor it must call the @value .setter function!

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2354 of file trfArgClasses.py.

2354 def value(self):
2355 return self._value
2356

◆ value() [2/2]

python.trfArgClasses.argSubstepSteering.value ( self,
value )

For strings passed to the setter we expect the format to be substep:{in/out}{+/-}DATATYPE or to be a steering alias, which is then expanded to the more complex format. This is then cast into a dictionary of tuples {substep: [('in/out', '+/-', DATATYPE), ...], ...}

Reimplemented from python.trfArgClasses.argSubstep.

Definition at line 2373 of file trfArgClasses.py.

2373 def value(self, value):
2374 msg.debug('Attempting to set argSubstepSteering from {0!s} (type {1})'.format(value, type(value)))
2375 if value is None:
2376 self._value = {}
2377 self._dumpvalue = [""]
2378 elif isinstance(value, dict):
2379 # OK, this should be the direct setable dictionary - but do a check of that
2380 for k, v in value.items():
2381 if not isinstance(k, str) or not isinstance(v, list):
2382 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2383 'Failed to convert dict {0!s} to argSubstepSteering'.format(value))
2384 for subv in v:
2385 if not isinstance(subv, (list, tuple)) or len(subv) != 3 or subv[0] not in ('in', 'out') or subv[1] not in ('+', '-'):
2386 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2387 'Failed to convert dict {0!s} to argSubstepSteering'.format(value))
2388 self._value = value
2389 # Note we are a little careful here to never reset the dumpvalue - this is
2390 # because when processing the _list_ of steering arguments down to a single
2391 # multi-valued argument we re-call value() with an expanded diectionary and
2392 # one can nievely reset dumpvalue by mistake
2393 self._dumpvalue = getattr(self, "_dumpvalue", value)
2394 elif isinstance(value, (str, list, tuple)):
2395 if isinstance(value, str):
2396 value = [value,]
2397 self._dumpvalue = getattr(self, "_dumpvalue", value)
2398 # Now we have a list of strings to parse
2399 self._value = {}
2400 for item in value:
2401 if not isinstance(item, str):
2402 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2403 'Failed to convert list item {0!s} to substep (should be a string)'.format(item))
2404 if item in argSubstepSteering.steeringAlises:
2405 msg.debug("Found value {0} in steeringAlises ({1})".format(item, argSubstepSteering.steeringAlises[item]))
2406 for substep, steerlist in argSubstepSteering.steeringAlises[item].items():
2407 if substep in self._value:
2408 self._value[substep].extend(steerlist)
2409 else:
2410 self._value[substep] = steerlist
2411 else:
2412 subStepList = self._parseStringAsSubstep(item)
2413 self._value.update(dict([(subStep[0], self._parseSteeringString(subStep[1])) for subStep in subStepList]))
2414 else:
2415 raise trfExceptions.TransformArgException(trfExit.nameToCode('TRF_ARG_CONV_FAIL'),
2416 'Setter value {0!s} (type {1}) for substep argument cannot be parsed'.format(value, type(value)))
2417

Member Data Documentation

◆ _defaultSubstep

python.trfArgClasses.argSubstep._defaultSubstep = defaultSubstep
protectedinherited

Definition at line 1966 of file trfArgClasses.py.

◆ _dumpvalue

list python.trfArgClasses.argSubstepSteering._dumpvalue = [""]
protected

Definition at line 2377 of file trfArgClasses.py.

◆ _name

python.trfArgClasses.argument._name = name
protectedinherited

Definition at line 111 of file trfArgClasses.py.

◆ _runarg

python.trfArgClasses.argument._runarg = runarg
protectedinherited

Definition at line 110 of file trfArgClasses.py.

◆ _separator

python.trfArgClasses.argSubstep._separator = separator
protectedinherited

Definition at line 1967 of file trfArgClasses.py.

◆ _value

python.trfArgClasses.argument._value = value
protectedinherited

Definition at line 130 of file trfArgClasses.py.

◆ steeringAlises

dict python.trfArgClasses.argSubstepSteering.steeringAlises
static
Initial value:
= {
'no': {},
'doRDO_TRIG': {'RAWtoALL': [('in', '-', 'RDO'), ('in', '+', 'RDO_TRIG'), ('in', '-', 'BS')]},
'doOverlay': {'HITtoRDO': [('in', '-', 'HITS'), ('out', '-', 'RDO'), ('out', '-', 'RDO_FILT')],
'Overlay': [('in', '+', ('HITS', 'RDO_BKG')), ('out', '+', 'RDO')]},
'doFCtoDAOD': {'Derivation': [('in', '-', 'EVNT')]},
'afterburn': {'generate': [('out', '-', 'EVNT')]},
'doRAWtoALL': {},
'doTRIGtoALL': {}
}

Definition at line 2341 of file trfArgClasses.py.


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