CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Config.Modifier Class Reference
Inheritance diagram for Config.Modifier:

Public Member Functions

def __and__
 
def __init__
 
def __invert__
 
def __or__
 
def makeProcessModifier
 
def toModify
 
def toReplaceWith
 

Private Member Functions

def _isChosen
 
def _isOrContains
 
def _setChosen
 

Static Private Member Functions

def _toModify
 
def _toModifyCheck
 
def _toReplaceWith
 
def _toReplaceWithCheck
 

Private Attributes

 __chosen
 
 __processModifiers
 

Detailed Description

This class is used to define standard modifications to a Process.
An instance of this class is declared to denote a specific modification,e.g. era2017 could
reconfigure items in a process to match our expectation of running in 2017. Once declared,
these Modifier instances are imported into a configuration and items that need to be modified
are then associated with the Modifier and with the action to do the modification.
The registered modifications will only occur if the Modifier was passed to 
the cms.Process' constructor.

Definition at line 1724 of file Config.py.

Constructor & Destructor Documentation

def Config.Modifier.__init__ (   self)

Definition at line 1733 of file Config.py.

1734  def __init__(self):
self.__chosen = False

Member Function Documentation

def Config.Modifier.__and__ (   self,
  other 
)

Definition at line 1805 of file Config.py.

1806  def __and__(self, other):
return _AndModifier(self,other)
def Config.Modifier.__invert__ (   self)

Definition at line 1807 of file Config.py.

1808  def __invert__(self):
return _InvertModifier(self)
def Config.Modifier.__or__ (   self,
  other 
)

Definition at line 1809 of file Config.py.

Referenced by LumiList.LumiList.__add__().

1810  def __or__(self, other):
return _OrModifier(self,other)
def Config.Modifier._isChosen (   self)
private

Definition at line 1803 of file Config.py.

References Config.Modifier.__chosen.

Referenced by Config._BoolModifierBase.toModify(), Config.Modifier.toModify(), Config._BoolModifierBase.toReplaceWith(), and Config.Modifier.toReplaceWith().

1804  def _isChosen(self):
return self.__chosen
def Config.Modifier._isOrContains (   self,
  other 
)
private

Definition at line 1811 of file Config.py.

Referenced by Config.ModifierChain.__copyIfExclude().

1812  def _isOrContains(self, other):
1813  return self == other
1814 
def _isOrContains
Definition: Config.py:1811
def Config.Modifier._setChosen (   self)
private
Should only be called by cms.Process instances

Definition at line 1800 of file Config.py.

References Config.Modifier.__chosen.

1801  def _setChosen(self):
1802  """Should only be called by cms.Process instances"""
self.__chosen = True
def Config.Modifier._toModify (   obj,
  func,
  kw 
)
staticprivate

Definition at line 1764 of file Config.py.

References cms::cuda.func, and groupFilesInBlocks.temp.

1765  def _toModify(obj,func,**kw):
1766  if func is not None:
1767  func(obj)
1768  else:
1769  temp =_ParameterModifier(kw)
temp(obj)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t Func __host__ __device__ V int Func func
def Config.Modifier._toModifyCheck (   obj,
  func,
  kw 
)
staticprivate

Definition at line 1743 of file Config.py.

1744  def _toModifyCheck(obj,func,**kw):
1745  if func is not None and len(kw) != 0:
raise TypeError("toModify takes either two arguments or one argument and key/value pairs")
def _toModifyCheck
Definition: Config.py:1743
def Config.Modifier._toReplaceWith (   toObj,
  fromObj 
)
staticprivate

Definition at line 1782 of file Config.py.

References str.

1783  def _toReplaceWith(toObj,fromObj):
1784  if isinstance(fromObj,_ModuleSequenceType):
1785  toObj._seq = fromObj._seq
1786  toObj._tasks = fromObj._tasks
1787  elif isinstance(fromObj,Task):
1788  toObj._collection = fromObj._collection
1789  elif isinstance(fromObj,_Parameterizable):
1790  #clear old items just incase fromObj is not a complete superset of toObj
1791  for p in toObj.parameterNames_():
1792  delattr(toObj,p)
1793  for p in fromObj.parameterNames_():
1794  setattr(toObj,p,getattr(fromObj,p))
1795  if isinstance(fromObj,_TypedParameterizable):
1796  toObj._TypedParameterizable__type = fromObj._TypedParameterizable__type
1797 
1798  else:
1799  raise TypeError("toReplaceWith does not work with type "+str(type(toObj)))
def _toReplaceWith
Definition: Config.py:1782
#define str(s)
def Config.Modifier._toReplaceWithCheck (   toObj,
  fromObj 
)
staticprivate

Definition at line 1771 of file Config.py.

1772  def _toReplaceWithCheck(toObj,fromObj):
1773  if not isinstance(fromObj, type(toObj)):
raise TypeError("toReplaceWith requires both arguments to be the same class type")
def _toReplaceWithCheck
Definition: Config.py:1771
def Config.Modifier.makeProcessModifier (   self,
  func 
)
This is used to create a ProcessModifer that can perform actions on the process as a whole.
   This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process.
   In order to work, the value returned from this function must be assigned to a uniquely named variable.

Definition at line 1736 of file Config.py.

1737  def makeProcessModifier(self,func):
1738  """This is used to create a ProcessModifer that can perform actions on the process as a whole.
1739  This takes as argument a callable object (e.g. function) that takes as its sole argument an instance of Process.
1740  In order to work, the value returned from this function must be assigned to a uniquely named variable.
1741  """
return ProcessModifier(self,func)
def makeProcessModifier
Definition: Config.py:1736
def Config.Modifier.toModify (   self,
  obj,
  func = None,
  kw 
)
This is used to register an action to be performed on the specific object. Two different forms are allowed
Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument
that will be the object passed in as the first argument.
Form 2: A list of parameter name, value pairs can be passed
   mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14))
This form can also be used to remove a parameter by passing the value of None
    #remove the parameter foo.fred       
    mod.toModify(foo, fred = None)
Additionally, parameters embedded within PSets can also be modified using a dictionary
    #change foo.fred.pebbles to 3 and foo.fred.friend to "barney"
    mod.toModify(foo, fred = dict(pebbles = 3, friend = "barney)) )

Definition at line 1746 of file Config.py.

References Config._AndModifier._isChosen(), Config._InvertModifier._isChosen(), Config._OrModifier._isChosen(), and Config.Modifier._isChosen().

1747  def toModify(self,obj, func=None,**kw):
1748  """This is used to register an action to be performed on the specific object. Two different forms are allowed
1749  Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument
1750  that will be the object passed in as the first argument.
1751  Form 2: A list of parameter name, value pairs can be passed
1752  mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14))
1753  This form can also be used to remove a parameter by passing the value of None
1754  #remove the parameter foo.fred
1755  mod.toModify(foo, fred = None)
1756  Additionally, parameters embedded within PSets can also be modified using a dictionary
1757  #change foo.fred.pebbles to 3 and foo.fred.friend to "barney"
1758  mod.toModify(foo, fred = dict(pebbles = 3, friend = "barney)) )
1759  """
1760  Modifier._toModifyCheck(obj,func,**kw)
1761  if not self._isChosen():
1762  return
Modifier._toModify(obj,func,**kw)
def Config.Modifier.toReplaceWith (   self,
  toObj,
  fromObj 
)
If the Modifier is chosen the internals of toObj will be associated with the internals of fromObj

Definition at line 1774 of file Config.py.

References Config._AndModifier._isChosen(), Config._InvertModifier._isChosen(), Config._OrModifier._isChosen(), and Config.Modifier._isChosen().

1775  def toReplaceWith(self,toObj,fromObj):
1776  """If the Modifier is chosen the internals of toObj will be associated with the internals of fromObj
1777  """
1778  Modifier._toReplaceWithCheck(toObj,fromObj)
1779  if not self._isChosen():
1780  return
Modifier._toReplaceWith(toObj,fromObj)
def toReplaceWith
Definition: Config.py:1774

Member Data Documentation

Config.Modifier.__chosen
private

Definition at line 1735 of file Config.py.

Referenced by Config.Modifier._isChosen(), Config.ModifierChain._isChosen(), Config.Modifier._setChosen(), and Config.ModifierChain._setChosen().

Config.Modifier.__processModifiers
private

Definition at line 1734 of file Config.py.