CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
SequenceTypes.Task Class Reference
Inheritance diagram for SequenceTypes.Task:
Mixins._ConfigureComponent Mixins._Labelable

Public Member Functions

def __init__ (self, items)
 
def __iter__ (self)
 
def __repr__ (self)
 
def __setattr__ (self, name, value)
 
def __str__ (self)
 
def add (self, items)
 
def contains (self, mod)
 
def copy (self)
 
def copyAndExclude (self, listOfModulesToExclude)
 
def dumpPython (self, options=PrintOptions())
 
def dumpPythonNoNewline (self, options=PrintOptions())
 
def expandAndClone (self)
 
def fillContents (self, taskContents, options=PrintOptions())
 
def isLeaf (self)
 
def moduleNames (self)
 
def remove (self, something)
 
def replace (self, original, replacement)
 
def resolve (self, processDict, keepIfCannotResolve=False)
 
def visit (self, visitor)
 
- Public Member Functions inherited from Mixins._Labelable
def __str__ (self)
 
def dumpSequenceConfig (self)
 
def dumpSequencePython (self, options=PrintOptions())
 
def hasLabel_ (self)
 
def label (self)
 
def label_ (self)
 
def setLabel (self, label)
 

Private Member Functions

def _errorstr (self)
 
def _isTaskComponent (self)
 
def _place (self, name, proc)
 

Private Attributes

 _collection
 

Detailed Description

Holds EDProducers, EDFilters, ESProducers, ESSources, Services, and Tasks.
A Task can be associated with Sequences, Paths, EndPaths and the Schedule.
An EDProducer or EDFilter will be enabled to run unscheduled if it is on
a task associated with the Schedule or any scheduled Path or EndPath (directly
or indirectly through Sequences) and not be on any scheduled Path or EndPath.
ESSources, ESProducers, and Services will be enabled to run if they are on
a Task associated with the Schedule or a scheduled Path or EndPath.  In other
cases, they will be enabled to run if and only if they are not on a Task attached
to the process.

Definition at line 1269 of file SequenceTypes.py.

Constructor & Destructor Documentation

def SequenceTypes.Task.__init__ (   self,
  items 
)

Definition at line 1281 of file SequenceTypes.py.

1281  def __init__(self, *items):
1283  self.add(*items)
1284 
def add(self, items)
def __init__(self, items)

Member Function Documentation

def SequenceTypes.Task.__iter__ (   self)

Definition at line 1352 of file SequenceTypes.py.

References SequenceTypes._SequenceCollection._collection, and SequenceTypes.Task._collection.

1352  def __iter__(self):
1353  for key in self._collection:
1354  yield key
1355 
def SequenceTypes.Task.__repr__ (   self)

Definition at line 1367 of file SequenceTypes.py.

References str.

1367  def __repr__(self):
1368  s = str(self)
1369  return "cms."+type(self).__name__+'('+s+')\n'
1370 
#define str(s)
def SequenceTypes.Task.__setattr__ (   self,
  name,
  value 
)

Definition at line 1285 of file SequenceTypes.py.

Referenced by GenObject.GenObject.setValue().

1285  def __setattr__(self,name,value):
1286  if not name.startswith("_"):
1287  raise AttributeError("You cannot set parameters for Task objects.")
1288  else:
1289  self.__dict__[name] = value
1290 
def __setattr__(self, name, value)
def SequenceTypes.Task.__str__ (   self)

Definition at line 1356 of file SequenceTypes.py.

References SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

1356  def __str__(self):
1357  l = []
1358  v = ModuleNodeVisitor(l)
1359  self.visit(v)
1360  s = ''
1361  for i in l:
1362  if s:
1363  s += ', '
1364  s += str (i)
1365  return s
1366 
def visit(self, visitor)
def SequenceTypes.Task._errorstr (   self)
private

Definition at line 1349 of file SequenceTypes.py.

1349  def _errorstr(self):
1350  return "Task(...)"
1351 
def SequenceTypes.Task._isTaskComponent (   self)
private

Definition at line 1336 of file SequenceTypes.py.

1336  def _isTaskComponent(self):
1337  return True
1338 
def _isTaskComponent(self)
def SequenceTypes.Task._place (   self,
  name,
  proc 
)
private

Definition at line 1299 of file SequenceTypes.py.

1299  def _place(self, name, proc):
1300  proc._placeTask(name,self)
1301 
def _place(self, name, proc)
def SequenceTypes.Task.add (   self,
  items 
)

Definition at line 1291 of file SequenceTypes.py.

Referenced by counter.Counter.register(), SequenceTypes.Task.remove(), and SequenceTypes.Task.replace().

1291  def add(self, *items):
1292  for item in items:
1293  if not isinstance(item, _ConfigureComponent) or not item._isTaskComponent():
1294  if not isinstance(item, TaskPlaceholder):
1295  raise RuntimeError("Adding an entry of type '" + type(item).__name__ + "'to a Task.\n"
1296  "It is illegal to add this type to a Task.")
1297  self._collection.add(item)
1298 
def add(self, items)
def SequenceTypes.Task.contains (   self,
  mod 
)

Definition at line 1377 of file SequenceTypes.py.

References SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

Referenced by LumiList.LumiList.__contains__().

1377  def contains(self, mod):
1378  visitor = ContainsModuleVisitor(mod)
1379  self.visit(visitor)
1380  return visitor.result()
def visit(self, visitor)
def contains(self, mod)
def SequenceTypes.Task.copy (   self)
def SequenceTypes.Task.copyAndExclude (   self,
  listOfModulesToExclude 
)
Returns a copy of the sequence which excludes those module in 'listOfModulesToExclude'

Definition at line 1383 of file SequenceTypes.py.

References SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

1383  def copyAndExclude(self,listOfModulesToExclude):
1384  """Returns a copy of the sequence which excludes those module in 'listOfModulesToExclude'"""
1385  # You can exclude instances of these types EDProducer, EDFilter, ESSource, ESProducer,
1386  # Service, or Task.
1387  # Mostly this is very intuitive, but there are some complications in cases
1388  # where objects that contain other objects are involved. See the comments
1389  # for the _MutatingSequenceVisitor.
1390  for i in listOfModulesToExclude:
1391  if not i._isTaskComponent():
1392  raise TypeError("copyAndExclude can only exclude objects that can be placed on a Task")
1393  v = _CopyAndExcludeSequenceVisitor(listOfModulesToExclude)
1394  self.visit(v)
1395  return Task(*v.result(self))
def copyAndExclude(self, listOfModulesToExclude)
def visit(self, visitor)
def SequenceTypes.Task.dumpPython (   self,
  options = PrintOptions() 
)

Definition at line 1313 of file SequenceTypes.py.

References SequenceTypes._ModuleSequenceType.dumpPythonNoNewline(), and SequenceTypes.Task.dumpPythonNoNewline().

1313  def dumpPython(self, options=PrintOptions()):
1314  s = self.dumpPythonNoNewline(options)
1315  return s + "\n"
1316 
def dumpPython(self, options=PrintOptions())
def dumpPythonNoNewline(self, options=PrintOptions())
def SequenceTypes.Task.dumpPythonNoNewline (   self,
  options = PrintOptions() 
)
Returns a string which is the python representation of the object

Definition at line 1317 of file SequenceTypes.py.

References SequenceTypes._SequenceCollection._collection, and SequenceTypes.Task._collection.

Referenced by SequenceTypes.Task.dumpPython().

1317  def dumpPythonNoNewline(self, options=PrintOptions()):
1318  """Returns a string which is the python representation of the object"""
1319  taskContents = set()
1320  for i in self._collection:
1321  if isinstance(i, Task):
1322  i.fillContents(taskContents, options)
1323  else:
1324  taskContents.add(i.dumpSequencePython(options))
1325  s=''
1326  iFirst = True
1327  for item in sorted(taskContents):
1328  if not iFirst:
1329  s += ", "
1330  iFirst = False
1331  s += item
1332  if len(taskContents) > 255:
1333  return "cms.Task(*[" + s + "])"
1334  return "cms.Task(" + s + ")"
1335 
def dumpPythonNoNewline(self, options=PrintOptions())
def SequenceTypes.Task.expandAndClone (   self)

Definition at line 1396 of file SequenceTypes.py.

References SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

1396  def expandAndClone(self):
1397  # Name of this function is not very good. It makes a shallow copy with all
1398  # the subTasks flattened out (removed), but keeping all the
1399  # modules that were in those subTasks as well as the top level
1400  # ones.
1401  l = []
1402  v = ModuleNodeVisitor(l)
1403  self.visit(v)
1404  return Task(*l)
def expandAndClone(self)
def visit(self, visitor)
def SequenceTypes.Task.fillContents (   self,
  taskContents,
  options = PrintOptions() 
)

Definition at line 1302 of file SequenceTypes.py.

References SequenceTypes._SequenceCollection._collection, SequenceTypes.Task._collection, and Mixins._Labelable.hasLabel_().

1302  def fillContents(self, taskContents, options=PrintOptions()):
1303  # only dump the label, if possible
1304  if self.hasLabel_():
1305  taskContents.add(_Labelable.dumpSequencePython(self, options))
1306  else:
1307  for i in self._collection:
1308  if isinstance(i, Task):
1309  i.fillContents(taskContents, options)
1310  else:
1311  taskContents.add(i.dumpSequencePython(options))
1312 
def fillContents(self, taskContents, options=PrintOptions())
def hasLabel_(self)
Definition: Mixins.py:493
def SequenceTypes.Task.isLeaf (   self)

Definition at line 1339 of file SequenceTypes.py.

1339  def isLeaf(self):
1340  return False
1341 
def SequenceTypes.Task.moduleNames (   self)
Returns a set containing the names of all modules being used

Definition at line 1371 of file SequenceTypes.py.

References SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

1371  def moduleNames(self):
1372  """Returns a set containing the names of all modules being used"""
1373  result = set()
1374  visitor = NodeNameVisitor(result)
1375  self.visit(visitor)
1376  return result
def visit(self, visitor)
def SequenceTypes.Task.remove (   self,
  something 
)
Remove the first occurrence of a module
   Returns 'True' if the module has been removed, False if it was not found

Definition at line 1427 of file SequenceTypes.py.

References OOTPileupCorrectionColl.add(), StringMap.add(), CSCAnodeDataFormat.add(), sistrip::WarningSummary.add(), RPCAMCLinkCounters.add(), PuppiAlgo.add(), StorableDoubleMap< T >.add(), btagbtvdeep::DeepBoostedJetFeatures.add(), CSCRPCData.add(), RPCLinkSynchroStat.add(), Majority< T >.add(), edm::ExceptionToActionTable.add(), rpcrawtodigi::EventRecords.add(), CSCAnodeData.add(), ESCrcKchipFast.add(), HcalIndexLookup.add(), sipixelobjects::PixelFEDLink.add(), SiStripMiscalibrate::Entry.add(), SiPixelDetSummary.add(), LinkConnSpec.add(), pos::PixelConfig.add(), DigiCollectionFP420.add(), DccSpec.add(), helper::CandDecayStoreManager.add(), TriggerBoardSpec.add(), CSCCFEBData.add(), LinkBoardSpec.add(), edm::helper::Filler< Map >.add(), RPCLinkSynchroStat::LinkBoard.add(), EventWithHistory.add(), sistrip::LinearFit.add(), pat::EventHypothesis.add(), beamerCreator.Out.add(), Averages.add(), AlignmentSurfaceDeformations.add(), SiStripPI::Entry.add(), TkHistoMap.add(), RPCReadOutMapping.add(), OrderedSet.OrderedSet.add(), CSCDDUEventData.add(), FWTypeToRepresentations.add(), edm::ConfigurationDescriptions.add(), CSCAnodeData2007.add(), CSCCLCTData.add(), FWParameterizable.add(), FWConfigurationManager.add(), FWViewManagerManager.add(), SiStripDetSummary.add(), DTKeyedConfig.add(), L1TriggerKeyExt.add(), CSCDigiToRaw.add(), L1TriggerKey.add(), CSCAnodeData2006.add(), AlignmentParameterBuilder.add(), SiStripQuality.add(), edm::CountAndLimit.add(), edm::service::ELlimitsTable.add(), FWEventItemsManager.add(), DTVDriftCalibration::cellInfo.add(), edm::EventSetupImpl.add(), reco::Vertex.add(), reco::CastorTower.add(), sistrip::MeanAndStdDev.add(), amc13::Packet.add(), GEMROmap.add(), edm::StatsCount.add(), edm::eventsetup::EventSetupProvider.add(), reco::CastorCluster.add(), edm::Association< C >::Filler.add(), edm::eventsetup::EventSetupRecordProvider.add(), AlignmentParameterSelector.add(), edm::ParameterSetDescription.add(), PrimaryVertexValidation.add(), CSCALCTs2006.add(), Phase2ITPixelCluster.add(), SiPixelQuality.add(), GEMROMapping.add(), SiPixelCluster.add(), edm::Association< C >.add(), CSCEventData.add(), jsoncollector::IntJ.add(), pos::PixelConfigList.add(), edm::WaitingTaskList.add(), edm::eventsetup::EventSetupRecordImpl.add(), MicroME.add(), CTPPSRPAlignmentCorrectionData.add(), CSCTMBHeader.add(), Folder.add(), popcon::PopConSourceHandler< T >.add(), o2olib.O2OJobMgr.add(), CSCALCTHeader.add(), edm::ValueMap< T >.add(), PhysicsTools::Calibration::MVAComputerContainer.add(), pat::MET::PackedMETUncertainty.add(), SequenceTypes.Task.add(), SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

1427  def remove(self, something):
1428  """Remove the first occurrence of a module
1429  Returns 'True' if the module has been removed, False if it was not found"""
1430  # You can remove instances of these types EDProducer, EDFilter, ESSource,
1431  # ESProducer, Service, or Task,
1432  #
1433  # Mostly this is very intuitive, but there are some complications in cases
1434  # where objects that contain other objects are involved. See the comments
1435  # for the _MutatingSequenceVisitor.
1436  #
1437  # Works very similar to copyAndExclude, there are 2 differences. This changes
1438  # the object itself instead of making a copy and second it only removes
1439  # the first instance of the argument instead of all of them.
1440  if not something._isTaskComponent():
1441  raise TypeError("remove only works with objects that can be placed on a Task")
1442  v = _CopyAndRemoveFirstSequenceVisitor(something)
1443  self.visit(v)
1444  if v.didRemove():
1445  self._collection.clear()
1446  self.add(*v.result(self))
1447  return v.didRemove()
1448 
def remove(self, something)
def add(self, items)
def visit(self, visitor)
def SequenceTypes.Task.replace (   self,
  original,
  replacement 
)
Finds all instances of 'original' and substitutes 'replacement' for them.
   Returns 'True' if a replacement occurs.

Definition at line 1405 of file SequenceTypes.py.

References OOTPileupCorrectionColl.add(), StringMap.add(), CSCAnodeDataFormat.add(), sistrip::WarningSummary.add(), RPCAMCLinkCounters.add(), PuppiAlgo.add(), StorableDoubleMap< T >.add(), btagbtvdeep::DeepBoostedJetFeatures.add(), CSCRPCData.add(), RPCLinkSynchroStat.add(), Majority< T >.add(), edm::ExceptionToActionTable.add(), rpcrawtodigi::EventRecords.add(), HcalIndexLookup.add(), CSCAnodeData.add(), ESCrcKchipFast.add(), sipixelobjects::PixelFEDLink.add(), SiStripMiscalibrate::Entry.add(), SiPixelDetSummary.add(), LinkConnSpec.add(), pos::PixelConfig.add(), DigiCollectionFP420.add(), DccSpec.add(), helper::CandDecayStoreManager.add(), TriggerBoardSpec.add(), CSCCFEBData.add(), LinkBoardSpec.add(), edm::helper::Filler< Map >.add(), RPCLinkSynchroStat::LinkBoard.add(), EventWithHistory.add(), sistrip::LinearFit.add(), pat::EventHypothesis.add(), beamerCreator.Out.add(), Averages.add(), AlignmentSurfaceDeformations.add(), SiStripPI::Entry.add(), RPCReadOutMapping.add(), TkHistoMap.add(), OrderedSet.OrderedSet.add(), CSCDDUEventData.add(), FWTypeToRepresentations.add(), edm::ConfigurationDescriptions.add(), CSCAnodeData2007.add(), CSCCLCTData.add(), FWParameterizable.add(), FWConfigurationManager.add(), FWViewManagerManager.add(), SiStripDetSummary.add(), DTKeyedConfig.add(), L1TriggerKeyExt.add(), CSCDigiToRaw.add(), L1TriggerKey.add(), CSCAnodeData2006.add(), SiStripQuality.add(), AlignmentParameterBuilder.add(), edm::CountAndLimit.add(), FWEventItemsManager.add(), edm::service::ELlimitsTable.add(), DTVDriftCalibration::cellInfo.add(), edm::EventSetupImpl.add(), reco::Vertex.add(), reco::CastorTower.add(), sistrip::MeanAndStdDev.add(), amc13::Packet.add(), GEMROmap.add(), edm::StatsCount.add(), edm::eventsetup::EventSetupProvider.add(), reco::CastorCluster.add(), edm::Association< C >::Filler.add(), edm::eventsetup::EventSetupRecordProvider.add(), AlignmentParameterSelector.add(), edm::ParameterSetDescription.add(), PrimaryVertexValidation.add(), CSCALCTs2006.add(), SiPixelQuality.add(), Phase2ITPixelCluster.add(), SiPixelCluster.add(), GEMROMapping.add(), edm::Association< C >.add(), CSCEventData.add(), jsoncollector::IntJ.add(), pos::PixelConfigList.add(), edm::WaitingTaskList.add(), edm::eventsetup::EventSetupRecordImpl.add(), MicroME.add(), CTPPSRPAlignmentCorrectionData.add(), CSCTMBHeader.add(), Folder.add(), popcon::PopConSourceHandler< T >.add(), o2olib.O2OJobMgr.add(), CSCALCTHeader.add(), edm::ValueMap< T >.add(), PhysicsTools::Calibration::MVAComputerContainer.add(), pat::MET::PackedMETUncertainty.add(), SequenceTypes.Task.add(), str, SequenceTypes._ModuleSequenceType.visit(), and SequenceTypes.Task.visit().

1405  def replace(self, original, replacement):
1406  """Finds all instances of 'original' and substitutes 'replacement' for them.
1407  Returns 'True' if a replacement occurs."""
1408  # This works for either argument being of type EDProducer, EDFilter, ESProducer,
1409  # ESSource, Service, or Task.
1410  #
1411  # Mostly this is very intuitive, but there are some complications in cases
1412  # where objects that contain other objects are involved. See the comments
1413  # for the _MutatingSequenceVisitor.
1414 
1415  if not original._isTaskComponent() or (not replacement is None and not replacement._isTaskComponent()):
1416  raise TypeError("The Task replace function only works with objects that can be placed on a Task\n" + \
1417  " replace was called with original type = " + str(type(original)) + "\n" + \
1418  " and replacement type = " + str(type(replacement)) + "\n")
1419  else:
1420  v = _CopyAndReplaceSequenceVisitor(original,replacement)
1421  self.visit(v)
1422  if v.didReplace():
1423  self._collection.clear()
1424  self.add(*v.result(self))
1425  return v.didReplace()
1426 
def add(self, items)
def replace(self, original, replacement)
def visit(self, visitor)
#define str(s)
def SequenceTypes.Task.resolve (   self,
  processDict,
  keepIfCannotResolve = False 
)

Definition at line 1449 of file SequenceTypes.py.

References SequenceTypes._SequenceCollection._collection, and SequenceTypes.Task._collection.

1449  def resolve(self, processDict,keepIfCannotResolve=False):
1450  temp = OrderedSet()
1451  for i in self._collection:
1452  if isinstance(i, Task) or isinstance(i, TaskPlaceholder):
1453  temp.add(i.resolve(processDict,keepIfCannotResolve))
1454  else:
1455  temp.add(i)
1456  self._collection = temp
1457  return self
1458 
def resolve(self, processDict, keepIfCannotResolve=False)
def SequenceTypes.Task.visit (   self,
  visitor 
)

Definition at line 1342 of file SequenceTypes.py.

References SequenceTypes._SequenceCollection._collection, and SequenceTypes.Task._collection.

Referenced by SequenceTypes.Task.__str__(), SequenceTypes.Task.contains(), SequenceTypes.Task.copyAndExclude(), SequenceTypes.Task.expandAndClone(), SequenceTypes.Task.moduleNames(), SequenceTypes.Task.remove(), and SequenceTypes.Task.replace().

1342  def visit(self,visitor):
1343  for i in self._collection:
1344  visitor.enter(i)
1345  if not i.isLeaf():
1346  i.visit(visitor)
1347  visitor.leave(i)
1348 
def visit(self, visitor)

Member Data Documentation

SequenceTypes.Task._collection
private