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

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

Definition at line 45 of file EnablePSetHistory.py.

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

Definition at line 487 of file EnablePSetHistory.py.

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

Definition at line 545 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 537 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 495 of file EnablePSetHistory.py.

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

Definition at line 510 of file EnablePSetHistory.py.

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

Definition at line 506 of file EnablePSetHistory.py.

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

Definition at line 529 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 518 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 501 of file EnablePSetHistory.py.

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

Definition at line 63 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 76 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 82 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 70 of file EnablePSetHistory.py.

References mps_setup.append.

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

sequence history ####

Definition at line 446 of file EnablePSetHistory.py.

References str.

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

Definition at line 473 of file EnablePSetHistory.py.

References str.

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

Definition at line 466 of file EnablePSetHistory.py.

References str.

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

Definition at line 462 of file EnablePSetHistory.py.

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

Definition at line 128 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 155 of file EnablePSetHistory.py.

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

Definition at line 138 of file EnablePSetHistory.py.

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

Definition at line 142 of file EnablePSetHistory.py.

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

Definition at line 110 of file EnablePSetHistory.py.

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

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

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

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

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

Definition at line 151 of file EnablePSetHistory.py.

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

Definition at line 100 of file EnablePSetHistory.py.

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

Definition at line 374 of file EnablePSetHistory.py.

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

References list().

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

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

Definition at line 366 of file EnablePSetHistory.py.

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

Definition at line 405 of file EnablePSetHistory.py.

References auto_inspect().

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

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

Definition at line 430 of file EnablePSetHistory.py.

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

Definition at line 412 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 421 of file EnablePSetHistory.py.

References auto_inspect().

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

Definition at line 439 of file EnablePSetHistory.py.

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

References ConfigBuilder.dumpPython().

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

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

Definition at line 104 of file EnablePSetHistory.py.

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

Definition at line 283 of file EnablePSetHistory.py.

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

Definition at line 59 of file EnablePSetHistory.py.

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

Definition at line 480 of file EnablePSetHistory.py.

References str.

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

References auto_inspect(), and triggerObjects_cff.id.

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

Definition at line 94 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 88 of file EnablePSetHistory.py.

References mps_setup.append.

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

Definition at line 25 of file EnablePSetHistory.py.

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

Definition at line 29 of file EnablePSetHistory.py.

References triggerObjects_cff.id.

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

Variable Documentation

EnablePSetHistory._isModified
private

Definition at line 416 of file EnablePSetHistory.py.

EnablePSetHistory._modifications
private

Definition at line 401 of file EnablePSetHistory.py.