CMS 3D CMS Logo

Classes | Functions | Variables
EnablePSetHistory Namespace Reference

Classes

class  TestModificationTracking
 

Functions

def auto_inspect ()
 helpers for inspection #### More...
 
def new___init__ (self, l, k)
 
def new__Module_name (self)
 
def new__ModuleSequenceType__iadd__ (self, other)
 
def new__ModuleSequenceType__imul__ (self, other)
 
def new__ModuleSequenceType__init__ (self, arg, argv)
 
def new__ModuleSequenceType_copy (self)
 
def new__ModuleSequenceType_isModified (self)
 
def new__ModuleSequenceType_remove (self, original)
 
def new__ModuleSequenceType_replace (self, original, replacement)
 
def new__ModuleSequenceType_resetModified (self)
 
def new__place (self, name, mod, d)
 
def new__placeLooper (self, name, mod)
 
def new__placeService (self, typeName, mod)
 
def new__placeSource (self, name, mod)
 
def new__Sequenceable_name (self)
 sequence history #### More...
 
def new__SequenceIgnore_name (self)
 
def new__SequenceNegation_name (self)
 
def new__SequencePlaceholder_name (self)
 
def new_addAction (self, tool)
 
def new_checkRecording (self)
 
def new_deleteAction (self, i)
 
def new_disableRecording (self)
 
def new_dumpHistory (self, withImports=True)
 
def new_dumpModifications (self, comments=True, process=True, module=False, sequence=True, value=True, sort=True, group=True)
 
def new_dumpModificationsWithObjects (self, removeDuplicates=False)
 
def new_enableRecording (self)
 
def new_history (self, removeDuplicates=False)
 
def new_items_ (self)
 
def new_modificationCheckpoint (self)
 
def new_modifiedObjects (self)
 
def new_moduleItems_ (self)
 
def new_Parameterizable_addParameter (self, name, value)
 
def new_Parameterizable_init (self, a, k)
 parameterizable history #### More...
 
def new_Parameterizable_resetModified (self)
 
def new_Parameterizable_setattr (self, name, value)
 
def new_Parameterizeable_delattr (self, name)
 
def new_ParameterTypeBase_resetModified (self)
 
def new_recurseDumpModifications_ (self, name, o)
 
def new_recurseResetModified_ (self, o)
 
def new_resetHistory (self)
 
def new_resetModified (self)
 
def new_resetModifiedObjects (self)
 
def new_Sequence_name (self)
 
def new_setattr (self, name, value)
 
def new_setLooper_ (self, lpr)
 
def new_setSchedule_ (self, sch)
 
def new_SortedKeysDict__copy__ (self)
 
def new_SortedKeysDict__deepcopy__ (self, memo=None)
 

Variables

 _isModified
 
 _modifications
 

Function Documentation

def EnablePSetHistory.auto_inspect ( )

helpers for inspection ####

Definition at line 9 of file EnablePSetHistory.py.

Referenced by new__ModuleSequenceType__iadd__(), new__ModuleSequenceType__imul__(), new__ModuleSequenceType_remove(), new__ModuleSequenceType_replace(), new_Parameterizable_addParameter(), new_Parameterizable_setattr(), new_Parameterizeable_delattr(), and new_setattr().

10  if not ACTIVATE_INSPECTION:
11  return [("unknown","unknown","unknown")]
12  stack = inspect.stack()
13  while len(stack)>=1 and len(stack[0])>=2 and ('FWCore/ParameterSet' in stack[0][1] or 'FWCore/GuiBrowsers' in stack[0][1]):
14  stack = stack[1:]
15  if len(stack)>=1 and len(stack[0])>=3:
16  return stack
17  else:
18  return [("unknown","unknown","unknown")]
19 
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new___init__ (   self,
  l,
  k 
)

Definition at line 44 of file EnablePSetHistory.py.

44 def new___init__(self,*l,**k):
45  self.old___init__(*l,**k)
46  self.__dict__['_Process__history'] = []
47  self.__dict__['_Process__enableRecording'] = 0
48  self.__dict__['_Process__modifiedobjects'] = []
49  self.__dict__['_Process__modifiedcheckpoint'] = None
50  self.__dict__['_Process__modifications'] = []
51 cms.Process.old___init__=cms.Process.__init__
52 cms.Process.__init__=new___init__
53 
def new___init__(self, l, k)
def EnablePSetHistory.new__Module_name (   self)

Definition at line 486 of file EnablePSetHistory.py.

487  if hasattr(self,'_Labelable__label'):
488  return getattr(self,'_Labelable__label')
489  elif hasattr(self,'_TypedParameterizable__type'):
490  return 'unnamed(%s)'%getattr(self,'_TypedParameterizable__type')
491  return type(self).__name__
492 cms._Module._name_ = new__Module_name
493 
def EnablePSetHistory.new__ModuleSequenceType__iadd__ (   self,
  other 
)

Definition at line 544 of file EnablePSetHistory.py.

References auto_inspect().

545  stack = auto_inspect()
546  self._isModified=True
547  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'action':'append','new':other._name_(),'old':None})
548  return self.old__iadd__(other)
549 cms._ModuleSequenceType.old__iadd__ = cms._ModuleSequenceType.__iadd__
550 cms._ModuleSequenceType.__iadd__ = new__ModuleSequenceType__iadd__
551 
def new__ModuleSequenceType__iadd__(self, other)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new__ModuleSequenceType__imul__ (   self,
  other 
)

Definition at line 536 of file EnablePSetHistory.py.

References auto_inspect().

537  stack = auto_inspect()
538  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'action':'append','new':other._name_(),'old':None})
539  self._isModified=True
540  return self.old__iadd__(other)
541 cms._ModuleSequenceType.old__imul__ = cms._ModuleSequenceType.__imul__
542 cms._ModuleSequenceType.__imul__ = new__ModuleSequenceType__imul__
543 
def new__ModuleSequenceType__imul__(self, other)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new__ModuleSequenceType__init__ (   self,
  arg,
  argv 
)

Definition at line 494 of file EnablePSetHistory.py.

494 def new__ModuleSequenceType__init__(self,*arg,**argv):
495  self._modifications = []
496  self.old__init__(*arg,**argv)
497 cms._ModuleSequenceType.old__init__ = cms._ModuleSequenceType.__init__
498 cms._ModuleSequenceType.__init__ = new__ModuleSequenceType__init__
499 
def new__ModuleSequenceType__init__(self, arg, argv)
def EnablePSetHistory.new__ModuleSequenceType_copy (   self)

Definition at line 509 of file EnablePSetHistory.py.

510  returnValue = cms._ModuleSequenceType.__new__(type(self))
511  returnValue.__init__(self._seq)
512  returnValue._isModified = self._isModified
513  returnValue._modifications = deepcopy(self._modifications)
514  return returnValue
515 cms._ModuleSequenceType.copy = new__ModuleSequenceType_copy
516 
def new__ModuleSequenceType_copy(self)
def EnablePSetHistory.new__ModuleSequenceType_isModified (   self)

Definition at line 505 of file EnablePSetHistory.py.

506  return self._isModified
507 cms._ModuleSequenceType.isModified = new__ModuleSequenceType_isModified
508 
def new__ModuleSequenceType_isModified(self)
def EnablePSetHistory.new__ModuleSequenceType_remove (   self,
  original 
)

Definition at line 528 of file EnablePSetHistory.py.

References auto_inspect().

528 def new__ModuleSequenceType_remove(self, original):
529  stack = auto_inspect()
530  self._isModified=True
531  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'action':'remove','old':original._name_(),'new':None})
532  return self.old_remove(original)
533 cms._ModuleSequenceType.old_remove = cms._ModuleSequenceType.remove
534 cms._ModuleSequenceType.remove = new__ModuleSequenceType_remove
535 
def new__ModuleSequenceType_remove(self, original)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new__ModuleSequenceType_replace (   self,
  original,
  replacement 
)

Definition at line 517 of file EnablePSetHistory.py.

References auto_inspect().

517 def new__ModuleSequenceType_replace(self, original, replacement):
518  stack = auto_inspect()
519  self._isModified=True
520  if replacement is None:
521  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'action':'replace','old':original._name_(),'new':None})
522  else:
523  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'action':'replace','old':original._name_(),'new':replacement._name_()})
524  return self.old_replace(original, replacement)
525 cms._ModuleSequenceType.old_replace = cms._ModuleSequenceType.replace
526 cms._ModuleSequenceType.replace = new__ModuleSequenceType_replace
527 
def new__ModuleSequenceType_replace(self, original, replacement)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new__ModuleSequenceType_resetModified (   self)

Definition at line 500 of file EnablePSetHistory.py.

501  self._isModified=False
502  self._modifications = []
503 cms._ModuleSequenceType.resetModified = new__ModuleSequenceType_resetModified
504 
def new__ModuleSequenceType_resetModified(self)
def EnablePSetHistory.new__place (   self,
  name,
  mod,
  d 
)

Definition at line 62 of file EnablePSetHistory.py.

References mps_setup.append.

62 def new__place(self, name, mod, d):
63  self.old__place(name, mod, d)
64  if self._okToPlace(name, mod, d):
65  self.__dict__['_Process__modifiedobjects'].append(mod)
66 cms.Process.old__place=cms.Process._place
67 cms.Process._place=new__place
68 
def new__place(self, name, mod, d)
def EnablePSetHistory.new__placeLooper (   self,
  name,
  mod 
)

Definition at line 75 of file EnablePSetHistory.py.

References mps_setup.append.

75 def new__placeLooper(self, name, mod):
76  self.old__placeLooper(name, mod)
77  self.__dict__['_Process__modifiedobjects'].append(mod)
78 cms.Process.old__placeLooper=cms.Process._placeLooper
79 cms.Process._placeLooper=new__placeLooper
80 
def new__placeLooper(self, name, mod)
def EnablePSetHistory.new__placeService (   self,
  typeName,
  mod 
)

Definition at line 81 of file EnablePSetHistory.py.

References mps_setup.append.

81 def new__placeService(self, typeName, mod):
82  self.old__placeService(typeName, mod)
83  self.__dict__['_Process__modifiedobjects'].append(mod)
84 cms.Process.old__placeService=cms.Process._placeService
85 cms.Process._placeService=new__placeService
86 
def new__placeService(self, typeName, mod)
def EnablePSetHistory.new__placeSource (   self,
  name,
  mod 
)

Definition at line 69 of file EnablePSetHistory.py.

References mps_setup.append.

69 def new__placeSource(self, name, mod):
70  self.old__placeSource(name, mod)
71  self.__dict__['_Process__modifiedobjects'].append(mod)
72 cms.Process.old__placeSource=cms.Process._placeSource
73 cms.Process._placeSource=new__placeSource
74 
def new__placeSource(self, name, mod)
def EnablePSetHistory.new__Sequenceable_name (   self)

sequence history ####

Definition at line 445 of file EnablePSetHistory.py.

References str.

446  return ''
447 cms._Sequenceable._name_ = new__Sequenceable_name
448 
449 try:
450  # for backwards-compatibility with CMSSW_3_10_X
451  from FWCore.ParameterSet.SequenceTypes import _SequenceOperator
452 
453  def new__SequenceOperator_name(self):
454  return str(self._left._name_())+str(self._pySymbol)+str(self._right._name_())
455  _SequenceOperator._name_ = new__SequenceOperator_name
456 except:
457  pass
458 
def new__Sequenceable_name(self)
sequence history ####
#define str(s)
def EnablePSetHistory.new__SequenceIgnore_name (   self)

Definition at line 472 of file EnablePSetHistory.py.

References str.

473  if self._operand:
474  return '-'+str(self._operand._name_())
475  else:
476  return '-()'
477 _SequenceIgnore._name_ = new__SequenceIgnore_name
478 
def new__SequenceIgnore_name(self)
#define str(s)
def EnablePSetHistory.new__SequenceNegation_name (   self)

Definition at line 465 of file EnablePSetHistory.py.

References str.

466  if self._operand:
467  return '~'+str(self._operand._name_())
468  else:
469  return '~()'
470 _SequenceNegation._name_ = new__SequenceNegation_name
471 
def new__SequenceNegation_name(self)
#define str(s)
def EnablePSetHistory.new__SequencePlaceholder_name (   self)

Definition at line 461 of file EnablePSetHistory.py.

462  return self._name
463 SequencePlaceholder._name_ = new__SequencePlaceholder_name
464 
def new__SequencePlaceholder_name(self)
def EnablePSetHistory.new_addAction (   self,
  tool 
)

Definition at line 127 of file EnablePSetHistory.py.

References mps_setup.append.

127 def new_addAction(self,tool):
128  if self.__dict__['_Process__enableRecording'] == 0:
129  modifiedObjects=self.modifiedObjects()
130  for m,o in self.dumpModificationsWithObjects():
131  modifiedObjects+=o
132  self.__dict__['_Process__history'].append((tool,modifiedObjects))
133  self.resetModified()
134  self.resetModifiedObjects()
135 cms.Process.addAction=new_addAction
136 
def new_addAction(self, tool)
def EnablePSetHistory.new_checkRecording (   self)

Definition at line 154 of file EnablePSetHistory.py.

155  return self.__dict__['_Process__enableRecording']==0
156 cms.Process.checkRecording=new_checkRecording
157 
def new_checkRecording(self)
def EnablePSetHistory.new_deleteAction (   self,
  i 
)

Definition at line 137 of file EnablePSetHistory.py.

137 def new_deleteAction(self,i):
138  del self.__dict__['_Process__history'][i]
139 cms.Process.deleteAction=new_deleteAction
140 
def new_deleteAction(self, i)
def EnablePSetHistory.new_disableRecording (   self)

Definition at line 141 of file EnablePSetHistory.py.

142  if self.__dict__['_Process__enableRecording'] == 0:
143  # remember modifications in history
144  self.__dict__['_Process__history']+=self.dumpModificationsWithObjects()
145  self.resetModified()
146  self.resetModifiedObjects()
147  self.__dict__['_Process__enableRecording'] += 1
148 cms.Process.disableRecording=new_disableRecording
149 
def new_disableRecording(self)
def EnablePSetHistory.new_dumpHistory (   self,
  withImports = True 
)

Definition at line 109 of file EnablePSetHistory.py.

References join().

109 def new_dumpHistory(self,withImports=True):
110  dumpHistory=[]
111  for item,objects in self.history():
112  if isinstance(item,(str,unicode)):
113  dumpHistory.append(item +"\n")
114  else: # isTool
115  print item
116  dump=item.dumpPython()
117  if isinstance(dump,tuple):
118  if withImports and dump[0] not in dumpHistory:
119  dumpHistory.append(dump[0])
120  dumpHistory.append(dump[1] +"\n")
121  else:
122  dumpHistory.append(dump +"\n")
123 
124  return ''.join(dumpHistory)
125 cms.Process.dumpHistory=new_dumpHistory
126 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def new_dumpHistory(self, withImports=True)
def EnablePSetHistory.new_dumpModifications (   self,
  comments = True,
  process = True,
  module = False,
  sequence = True,
  value = True,
  sort = True,
  group = True 
)
Return some text describing all the modifications that have been made.

* comments: print out comments describing the file and line which triggered
            the modification, if determined.
* process: print "process." in front of every name
* module: only print out one entry per top-level module that has been
          changed, rather than the details
* sequence: include changes to sequences
* value: print out the latest value of each name
* sort: whether to sort all the names before printing (otherwise they're in
        more-or-less time order, within each category)

Definition at line 292 of file EnablePSetHistory.py.

References any(), join(), list(), and split.

292 def new_dumpModifications(self, comments=True, process=True, module=False, sequence=True, value=True, sort=True, group=True):
293  """
294  Return some text describing all the modifications that have been made.
295 
296  * comments: print out comments describing the file and line which triggered
297  the modification, if determined.
298  * process: print "process." in front of every name
299  * module: only print out one entry per top-level module that has been
300  changed, rather than the details
301  * sequence: include changes to sequences
302  * value: print out the latest value of each name
303  * sort: whether to sort all the names before printing (otherwise they're in
304  more-or-less time order, within each category)
305  """
306  modifications = self.recurseDumpModifications_('', self)
307  text = []
308  for name, o in self.items_():
309  modifications += self.recurseDumpModifications_(name, o)
310  if not sequence:
311  modifications = [x for x in modifications if not x['type'] == 'seq']
312  checkpoint = self.__dict__['_Process__modifiedcheckpoint']
313  if not checkpoint == None:
314  modifications = [x for x in modifications if any([x['name'].startswith(check) for check in checkpoint])]
315  if module:
316  value = False
317  comments = False
318  modules = list(set([m['name'].split('.')[0] for m in modifications]))
319  if sort:
320  modules = sorted(modules)
321  if process:
322  text = ['process.%s' % m for m in modules]
323  else:
324  text = modules
325  else:
326  if sort:
327  modifications = sorted(modifications, key=lambda x: x['name'])
328  for i, m in enumerate(modifications):
329  t = ''
330  if comments:
331  if m['action'] == 'replace':
332  t += '# %(file)s:%(line)s replace %(old)s->%(new)s\n' % m
333  elif m['action'] == 'remove':
334  t += '# %(file)s:%(line)s remove %(old)s\n' % m
335  elif m['action'] == 'append':
336  t += '# %(file)s:%(line)s append %(new)s\n' % m
337  if not group or i==len(modifications)-1 or not modifications[i+1]['name'] == m['name']:
338  if process and value:
339  t += 'process.%s = %s' % (m['name'], m['dump'])
340  elif value:
341  t += '%s = %s' % (m['name'], m['dump'])
342  elif process:
343  t += 'process.%s' % (m['name'])
344  else:
345  t += '%s' % (m['name'])
346  text += [t]
347  return '\n'.join(text)+'\n'
348 cms.Process.dumpModifications=new_dumpModifications
349 
def new_dumpModifications(self, comments=True, process=True, module=False, sequence=True, value=True, sort=True, group=True)
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def EnablePSetHistory.new_dumpModificationsWithObjects (   self,
  removeDuplicates = False 
)

Definition at line 350 of file EnablePSetHistory.py.

350 def new_dumpModificationsWithObjects(self, removeDuplicates=False):
351  modifications = []
352  last_modification=""
353  for name, o in self.items_():
354  for m in self.recurseDumpModifications_(name, o):
355  # remove duplicate modifications
356  if removeDuplicates and last_modification==m['name']:
357  modifications.pop()
358  last_modification=m['name']
359  # add changes
360  text = 'process.%s = %s' % (m['name'], m['dump'])
361  modifications += [(text,[o])]
362  return modifications
363 cms.Process.dumpModificationsWithObjects=new_dumpModificationsWithObjects
364 
def new_dumpModificationsWithObjects(self, removeDuplicates=False)
def EnablePSetHistory.new_enableRecording (   self)

Definition at line 150 of file EnablePSetHistory.py.

151  self.__dict__['_Process__enableRecording'] -= 1
152 cms.Process.enableRecording=new_enableRecording
153 
def new_enableRecording(self)
def EnablePSetHistory.new_history (   self,
  removeDuplicates = False 
)

Definition at line 99 of file EnablePSetHistory.py.

99 def new_history(self, removeDuplicates=False):
100  return self.__dict__['_Process__history']+self.dumpModificationsWithObjects(removeDuplicates)
101 cms.Process.history=new_history
102 
def new_history(self, removeDuplicates=False)
def EnablePSetHistory.new_items_ (   self)

Definition at line 373 of file EnablePSetHistory.py.

373 def new_items_(self):
374  items = []
375  if self.source:
376  items += [("source", self.source)]
377  if self.looper:
378  items += [("looper", self.looper)]
379  items += self.moduleItems_()
380  items += self.outputModules.items()
381  items += self.sequences.items()
382  items += six.iteritems(self.paths)
383  items += self.endpaths.items()
384  items += self.services.items()
385  items += self.es_producers.items()
386  items += self.es_sources.items()
387  items += self.es_prefers.items()
388  items += self.psets.items()
389  items += self.vpsets.items()
390  if self.schedule:
391  items += [("schedule", self.schedule)]
392  return tuple(items)
393 cms.Process.items_=new_items_
394 
def EnablePSetHistory.new_modificationCheckpoint (   self)
Set a checkpoint, ie get the current list of all known
top-level names and store them. Later, when we print out
modifications we ignore any modifications that do not affect
something in this list.

There is currently no way of clearing this, but I think this
is generally a use-once feature.

Definition at line 266 of file EnablePSetHistory.py.

References list().

267  """
268  Set a checkpoint, ie get the current list of all known
269  top-level names and store them. Later, when we print out
270  modifications we ignore any modifications that do not affect
271  something in this list.
272 
273  There is currently no way of clearing this, but I think this
274  is generally a use-once feature.
275  """
276  existing_names = set()
277  for item in self.items_():
278  existing_names.add(item[0])
279  self.__dict__['_Process__modifiedcheckpoint'] = list(existing_names)
280 cms.Process.modificationCheckpoint=new_modificationCheckpoint
281 
def new_modificationCheckpoint(self)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def EnablePSetHistory.new_modifiedObjects (   self)

Definition at line 54 of file EnablePSetHistory.py.

55  return self.__dict__['_Process__modifiedobjects']
56 cms.Process.modifiedObjects=new_modifiedObjects
57 
def new_modifiedObjects(self)
def EnablePSetHistory.new_moduleItems_ (   self)

Definition at line 365 of file EnablePSetHistory.py.

366  items = []
367  items += self.producers.items()
368  items += self.filters.items()
369  items += self.analyzers.items()
370  return tuple(items)
371 cms.Process.moduleItems_=new_moduleItems_
372 
def EnablePSetHistory.new_Parameterizable_addParameter (   self,
  name,
  value 
)

Definition at line 404 of file EnablePSetHistory.py.

References auto_inspect().

404 def new_Parameterizable_addParameter(self, name, value):
405  self.old__addParameter(name,value)
406  stack = auto_inspect()
407  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'name':name,'old':None,'new':deepcopy(value),'action':'add'})
408 cms._Parameterizable.old__addParameter = cms._Parameterizable._Parameterizable__addParameter
409 cms._Parameterizable._Parameterizable__addParameter = new_Parameterizable_addParameter
410 
def auto_inspect()
helpers for inspection ####
def new_Parameterizable_addParameter(self, name, value)
def EnablePSetHistory.new_Parameterizable_init (   self,
  a,
  k 
)

parameterizable history ####

Definition at line 397 of file EnablePSetHistory.py.

397 def new_Parameterizable_init(self,*a,**k):
398  self.__dict__['_modifications'] = []
399  self.old__init__(*a,**k)
400  self._modifications = []
401 cms._Parameterizable.old__init__ = cms._Parameterizable.__init__
402 cms._Parameterizable.__init__ = new_Parameterizable_init
403 
def new_Parameterizable_init(self, a, k)
parameterizable history ####
def EnablePSetHistory.new_Parameterizable_resetModified (   self)

Definition at line 429 of file EnablePSetHistory.py.

430  self._isModified=False
431  self._modifications = []
432  for name in self.parameterNames_():
433  param = self.__dict__[name]
434  if isinstance(param, cms._Parameterizable):
435  param.resetModified()
436 cms._Parameterizable.resetModified = new_Parameterizable_resetModified
437 
def new_Parameterizable_resetModified(self)
def EnablePSetHistory.new_Parameterizable_setattr (   self,
  name,
  value 
)

Definition at line 411 of file EnablePSetHistory.py.

References auto_inspect().

411 def new_Parameterizable_setattr(self, name, value):
412  if (not self.isFrozen()) and (not name.startswith('_')) and (name in self.__dict__):
413  stack = auto_inspect()
414  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'name':name,'old':deepcopy(self.__dict__[name]),'new':deepcopy(value),'action':'replace'})
415  self._isModified = True
416  self.old__setattr__(name,value)
417 cms._Parameterizable.old__setattr__ = cms._Parameterizable.__setattr__
418 cms._Parameterizable.__setattr__ = new_Parameterizable_setattr
419 
def new_Parameterizable_setattr(self, name, value)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new_Parameterizeable_delattr (   self,
  name 
)

Definition at line 420 of file EnablePSetHistory.py.

References auto_inspect().

421  if not self.isFrozen():
422  stack = auto_inspect()
423  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'name':name,'old':deepcopy(self.__dict__[name]), 'new':None,'action':'delete'})
424  self.old__delattr__(name)
425 cms._Parameterizable.old__delattr__ = cms._Parameterizable.__delattr__
426 cms._Parameterizable.__delattr__ = new_Parameterizeable_delattr
427 
428 
def new_Parameterizeable_delattr(self, name)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new_ParameterTypeBase_resetModified (   self)

Definition at line 438 of file EnablePSetHistory.py.

439  self._isModified=False
440  self._modifications = []
441 cms._ParameterTypeBase.resetModified = new_ParameterTypeBase_resetModified
442 
def new_ParameterTypeBase_resetModified(self)
def EnablePSetHistory.new_recurseDumpModifications_ (   self,
  name,
  o 
)
Recursively return a standardised list of modifications
from the object hierarchy.

Definition at line 203 of file EnablePSetHistory.py.

References ConfigBuilder.dumpPython().

203 def new_recurseDumpModifications_(self, name, o):
204  """
205  Recursively return a standardised list of modifications
206  from the object hierarchy.
207  """
208  modifications = []
209  if isinstance(o, cms._ModuleSequenceType):
210  if o._isModified:
211  for mod in o._modifications:
212  modifications.append({'name':name,
213  'action':mod['action'],
214  'old': mod['old'],
215  'new': mod['new'],
216  'file': mod['file'],
217  'line': mod['line'],
218  'dump': o.dumpPython({}),
219  'type': 'seq'})
220 
221  if isinstance(o, cms._Parameterizable):
222  for mod in o._modifications:
223  paramname = mod['name']
224  if hasattr(o, paramname):
225  paramvalue = getattr(o, paramname)
226  else:
227  paramvalue = None
228  if isinstance(paramvalue,cms._ParameterTypeBase):
229  dump = paramvalue.dumpPython()
230  else:
231  dump = paramvalue
232  modifications.append({'name': '%s.%s' %(name, paramname),
233  'old': mod['old'],
234  'new': mod['new'],
235  'file': mod['file'],
236  'line': mod['line'],
237  'action': mod['action'],
238  'dump': dump,
239  'type': 'param'})
240 
241  # Loop over any child elements
242  for key in o.parameterNames_():
243  value = getattr(o,key)
244  modifications += self.recurseDumpModifications_("%s.%s" % (name, key), value)
245 
246  if isinstance(o, cms._ValidatingListBase):
247  for index, item in enumerate(o):
248  modifications += self.recurseDumpModifications_("%s[%s]" % (name, index), item)
249  if isinstance(o, cms.Process):
250  for mod in o.__dict__['_Process__modifications']:
251  if hasattr(o, mod['name']) and hasattr(getattr(o, mod['name']), 'dumpPython'):
252  dump = getattr(o, mod['name']).dumpPython()
253  else:
254  dump = None
255  modifications.append({'name': mod['name'],
256  'action': mod['action'],
257  'old': mod['old'],
258  'new': mod['new'],
259  'dump': dump,
260  'file': mod['file'],
261  'line': mod['line'],
262  'type': 'process'})
263  return modifications
264 cms.Process.recurseDumpModifications_=new_recurseDumpModifications_
265 
def dumpPython(process, name)
def new_recurseDumpModifications_(self, name, o)
def EnablePSetHistory.new_recurseResetModified_ (   self,
  o 
)
Empty all the _modifications lists for
all objects beneath this one.

Definition at line 185 of file EnablePSetHistory.py.

186  """
187  Empty all the _modifications lists for
188  all objects beneath this one.
189  """
190  properties = []
191  if isinstance(o, cms._ModuleSequenceType):
192  o.resetModified()
193  if isinstance(o, cms._Parameterizable):
194  o.resetModified()
195  for key in o.parameterNames_():
196  value = getattr(o,key)
197  self.recurseResetModified_(value)
198  if isinstance(o, cms._ValidatingListBase):
199  for index,item in enumerate(o):
200  self.recurseResetModified_(item)
201 cms.Process.recurseResetModified_=new_recurseResetModified_
202 
def new_recurseResetModified_(self, o)
def EnablePSetHistory.new_resetHistory (   self)

Definition at line 103 of file EnablePSetHistory.py.

104  self.__dict__['_Process__history'] = []
105  self.resetModified()
106  self.resetModifiedObjects()
107 cms.Process.resetHistory=new_resetHistory
108 
def EnablePSetHistory.new_resetModified (   self)
Empty out all the modification lists, so we only see changes that
happen from now onwards.

Definition at line 282 of file EnablePSetHistory.py.

283  """
284  Empty out all the modification lists, so we only see changes that
285  happen from now onwards.
286  """
287  self.__dict__['_Process__modified'] = []
288  for name, o in self.items_():
289  self.recurseResetModified_(o)
290 cms.Process.resetModified=new_resetModified
291 
def EnablePSetHistory.new_resetModifiedObjects (   self)

Definition at line 58 of file EnablePSetHistory.py.

59  self.__dict__['_Process__modifiedobjects'] = []
60 cms.Process.resetModifiedObjects=new_resetModifiedObjects
61 
def new_resetModifiedObjects(self)
def EnablePSetHistory.new_Sequence_name (   self)

Definition at line 479 of file EnablePSetHistory.py.

References str.

480  if self._seq:
481  return '('+str(self._seq._name_())+')'
482  else:
483  return '()'
484 cms.Sequence._name_ = new_Sequence_name
485 
#define str(s)
def EnablePSetHistory.new_setattr (   self,
  name,
  value 
)
This catches modifications that occur during process.load,
and only records a modification if there was an existing object
and the version after __setattr__ has a different id().
This does not mean that the object is different, only redefined.
We still really need a recursive-comparison function for parameterizeable
objects to determine if a real change has been made.

Definition at line 158 of file EnablePSetHistory.py.

References auto_inspect(), and triggerObjects_cff.id.

158 def new_setattr(self, name, value):
159  """
160  This catches modifications that occur during process.load,
161  and only records a modification if there was an existing object
162  and the version after __setattr__ has a different id().
163  This does not mean that the object is different, only redefined.
164  We still really need a recursive-comparison function for parameterizeable
165  objects to determine if a real change has been made.
166  """
167  old = None
168  existing = False
169  if not name.startswith('_Process__'):
170  existing = hasattr(self, name)
171  if existing:
172  old = getattr(self, name)
173  self.old__setattr__(name, value)
174  if existing:
175  if id(getattr(self, name)) != id(old):
176  stack = auto_inspect()
177  self.__dict__['_Process__modifications'] += [{'name': name,
178  'old': deepcopy(old),
179  'new': deepcopy(getattr(self, name)),
180  'file':stack[0][1],'line':stack[0][2],
181  'action': 'replace'}]
182 cms.Process.old__setattr__ = cms.Process.__setattr__
183 cms.Process.__setattr__ = new_setattr
184 
def new_setattr(self, name, value)
def auto_inspect()
helpers for inspection ####
def EnablePSetHistory.new_setLooper_ (   self,
  lpr 
)

Definition at line 93 of file EnablePSetHistory.py.

References mps_setup.append.

93 def new_setLooper_(self, lpr):
94  self.old_setLooper_(lpr)
95  self.__dict__['_Process__modifiedobjects'].append(lpr)
96 cms.Process.old_setLooper_=cms.Process.setLooper_
97 cms.Process.setLooper_=new_setLooper_
98 
def new_setLooper_(self, lpr)
def EnablePSetHistory.new_setSchedule_ (   self,
  sch 
)

Definition at line 87 of file EnablePSetHistory.py.

References mps_setup.append.

87 def new_setSchedule_(self, sch):
88  self.old_setSchedule_(sch)
89  self.__dict__['_Process__modifiedobjects'].append(sch)
90 cms.Process.old_setSchedule_=cms.Process.setSchedule_
91 cms.Process.setSchedule_=new_setSchedule_
92 
def new_setSchedule_(self, sch)
def EnablePSetHistory.new_SortedKeysDict__copy__ (   self)

Definition at line 24 of file EnablePSetHistory.py.

25  return self.__class__(self)
26 typ.SortedKeysDict.__copy__ = new_SortedKeysDict__copy__
27 
def new_SortedKeysDict__copy__(self)
def EnablePSetHistory.new_SortedKeysDict__deepcopy__ (   self,
  memo = None 
)

Definition at line 28 of file EnablePSetHistory.py.

References triggerObjects_cff.id.

28 def new_SortedKeysDict__deepcopy__(self, memo=None):
29  from copy import deepcopy
30  if memo is None:
31  memo = {}
32  d = memo.get(id(self), None)
33  if d is not None:
34  return d
35  memo[id(self)] = d = self.__class__()
36  d.__init__(deepcopy(self.items(), memo))
37  return d
38 typ.SortedKeysDict.__deepcopy__ = new_SortedKeysDict__deepcopy__
39 
def new_SortedKeysDict__deepcopy__(self, memo=None)

Variable Documentation

EnablePSetHistory._isModified
private

Definition at line 415 of file EnablePSetHistory.py.

EnablePSetHistory._modifications
private

Definition at line 400 of file EnablePSetHistory.py.