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 11 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().

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

Definition at line 46 of file EnablePSetHistory.py.

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

Definition at line 488 of file EnablePSetHistory.py.

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

Definition at line 546 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 538 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 496 of file EnablePSetHistory.py.

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

Definition at line 511 of file EnablePSetHistory.py.

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

Definition at line 507 of file EnablePSetHistory.py.

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

Definition at line 530 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 519 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 502 of file EnablePSetHistory.py.

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

Definition at line 64 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 77 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 83 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 71 of file EnablePSetHistory.py.

References mps_setup.append.

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

sequence history ####

Definition at line 447 of file EnablePSetHistory.py.

References str.

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

Definition at line 474 of file EnablePSetHistory.py.

References str.

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

Definition at line 467 of file EnablePSetHistory.py.

References str.

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

Definition at line 463 of file EnablePSetHistory.py.

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

Definition at line 129 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 156 of file EnablePSetHistory.py.

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

Definition at line 139 of file EnablePSetHistory.py.

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

Definition at line 143 of file EnablePSetHistory.py.

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

Definition at line 111 of file EnablePSetHistory.py.

References join(), and edm.print().

111 def new_dumpHistory(self,withImports=True):
112  dumpHistory=[]
113  for item,objects in self.history():
114  if isinstance(item,(str,unicode)):
115  dumpHistory.append(item +"\n")
116  else: # isTool
117  print(item)
118  dump=item.dumpPython()
119  if isinstance(dump,tuple):
120  if withImports and dump[0] not in dumpHistory:
121  dumpHistory.append(dump[0])
122  dumpHistory.append(dump[1] +"\n")
123  else:
124  dumpHistory.append(dump +"\n")
125 
126  return ''.join(dumpHistory)
127 cms.Process.dumpHistory=new_dumpHistory
128 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
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 294 of file EnablePSetHistory.py.

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

294 def new_dumpModifications(self, comments=True, process=True, module=False, sequence=True, value=True, sort=True, group=True):
295  """
296  Return some text describing all the modifications that have been made.
297 
298  * comments: print out comments describing the file and line which triggered
299  the modification, if determined.
300  * process: print "process." in front of every name
301  * module: only print out one entry per top-level module that has been
302  changed, rather than the details
303  * sequence: include changes to sequences
304  * value: print out the latest value of each name
305  * sort: whether to sort all the names before printing (otherwise they're in
306  more-or-less time order, within each category)
307  """
308  modifications = self.recurseDumpModifications_('', self)
309  text = []
310  for name, o in self.items_():
311  modifications += self.recurseDumpModifications_(name, o)
312  if not sequence:
313  modifications = [x for x in modifications if not x['type'] == 'seq']
314  checkpoint = self.__dict__['_Process__modifiedcheckpoint']
315  if not checkpoint == None:
316  modifications = [x for x in modifications if any([x['name'].startswith(check) for check in checkpoint])]
317  if module:
318  value = False
319  comments = False
320  modules = list(set([m['name'].split('.')[0] for m in modifications]))
321  if sort:
322  modules = sorted(modules)
323  if process:
324  text = ['process.%s' % m for m in modules]
325  else:
326  text = modules
327  else:
328  if sort:
329  modifications = sorted(modifications, key=lambda x: x['name'])
330  for i, m in enumerate(modifications):
331  t = ''
332  if comments:
333  if m['action'] == 'replace':
334  t += '# %(file)s:%(line)s replace %(old)s->%(new)s\n' % m
335  elif m['action'] == 'remove':
336  t += '# %(file)s:%(line)s remove %(old)s\n' % m
337  elif m['action'] == 'append':
338  t += '# %(file)s:%(line)s append %(new)s\n' % m
339  if not group or i==len(modifications)-1 or not modifications[i+1]['name'] == m['name']:
340  if process and value:
341  t += 'process.%s = %s' % (m['name'], m['dump'])
342  elif value:
343  t += '%s = %s' % (m['name'], m['dump'])
344  elif process:
345  t += 'process.%s' % (m['name'])
346  else:
347  t += '%s' % (m['name'])
348  text += [t]
349  return '\n'.join(text)+'\n'
350 cms.Process.dumpModifications=new_dumpModifications
351 
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 352 of file EnablePSetHistory.py.

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

Definition at line 152 of file EnablePSetHistory.py.

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

Definition at line 101 of file EnablePSetHistory.py.

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

Definition at line 375 of file EnablePSetHistory.py.

375 def new_items_(self):
376  items = []
377  if self.source:
378  items += [("source", self.source)]
379  if self.looper:
380  items += [("looper", self.looper)]
381  items += self.moduleItems_()
382  items += self.outputModules.items()
383  items += self.sequences.items()
384  items += six.iteritems(self.paths)
385  items += self.endpaths.items()
386  items += self.services.items()
387  items += self.es_producers.items()
388  items += self.es_sources.items()
389  items += self.es_prefers.items()
390  items += self.psets.items()
391  items += self.vpsets.items()
392  if self.schedule:
393  items += [("schedule", self.schedule)]
394  return tuple(items)
395 cms.Process.items_=new_items_
396 
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 268 of file EnablePSetHistory.py.

References list().

269  """
270  Set a checkpoint, ie get the current list of all known
271  top-level names and store them. Later, when we print out
272  modifications we ignore any modifications that do not affect
273  something in this list.
274 
275  There is currently no way of clearing this, but I think this
276  is generally a use-once feature.
277  """
278  existing_names = set()
279  for item in self.items_():
280  existing_names.add(item[0])
281  self.__dict__['_Process__modifiedcheckpoint'] = list(existing_names)
282 cms.Process.modificationCheckpoint=new_modificationCheckpoint
283 
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 56 of file EnablePSetHistory.py.

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

Definition at line 367 of file EnablePSetHistory.py.

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

Definition at line 406 of file EnablePSetHistory.py.

References auto_inspect().

406 def new_Parameterizable_addParameter(self, name, value):
407  self.old__addParameter(name,value)
408  stack = auto_inspect()
409  self._modifications.append({'file':stack[0][1],'line':stack[0][2],'name':name,'old':None,'new':deepcopy(value),'action':'add'})
410 cms._Parameterizable.old__addParameter = cms._Parameterizable._Parameterizable__addParameter
411 cms._Parameterizable._Parameterizable__addParameter = new_Parameterizable_addParameter
412 
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 399 of file EnablePSetHistory.py.

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

Definition at line 431 of file EnablePSetHistory.py.

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

Definition at line 413 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 422 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 440 of file EnablePSetHistory.py.

441  self._isModified=False
442  self._modifications = []
443 cms._ParameterTypeBase.resetModified = new_ParameterTypeBase_resetModified
444 
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 205 of file EnablePSetHistory.py.

References ConfigBuilder.dumpPython().

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

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

Definition at line 105 of file EnablePSetHistory.py.

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

Definition at line 284 of file EnablePSetHistory.py.

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

Definition at line 60 of file EnablePSetHistory.py.

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

Definition at line 481 of file EnablePSetHistory.py.

References str.

482  if self._seq:
483  return '('+str(self._seq._name_())+')'
484  else:
485  return '()'
486 cms.Sequence._name_ = new_Sequence_name
487 
#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 160 of file EnablePSetHistory.py.

References auto_inspect(), and triggerObjects_cff.id.

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

Definition at line 95 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 89 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 26 of file EnablePSetHistory.py.

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

Definition at line 30 of file EnablePSetHistory.py.

References triggerObjects_cff.id.

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

Variable Documentation

EnablePSetHistory._isModified
private

Definition at line 417 of file EnablePSetHistory.py.

EnablePSetHistory._modifications
private

Definition at line 402 of file EnablePSetHistory.py.