Skip to content

Commit 5313b0a

Browse files
committed
Handle delayed get info in edmTracerCompatLogViewer
1 parent 822009a commit 5313b0a

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

FWCore/Services/scripts/edmTracerCompactLogViewer.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,11 @@ def textIfTransform(self):
479479
return ''
480480
def text(self, context):
481481
return f'{self.textPrefix(context)} {self.textSpecial()}{self.textIfTransform()}: {self.textPostfix()}'
482-
def _preJson(self, activity, counter, data, mayUseTemp = False):
482+
def _preJson(self, activity, counter, data, mayUseTemp = False, isSrc = False):
483483
index = self.index
484484
found = False
485485
if mayUseTemp:
486-
compare = lambda x: x['type'] == self.transition and x['id'] == self.index and x['mod'] == self.moduleID and x['call'] == self.callID and (x['act'] == Activity.temporary or x['act'] == Activity.externalWork)
486+
compare = lambda x: x['type'] == self.transition and x['id'] == self.index and x['mod'] == self.moduleID and x['call'] == self.callID and ((x.get('isSrc') != None) == isSrc ) and (x['act'] == Activity.temporary or x['act'] == Activity.externalWork)
487487
if transitionIsGlobal(self.transition):
488488
item,slot = data.findLastInModGlobals(index, self.moduleID, compare)
489489
else:
@@ -501,8 +501,8 @@ def _preJson(self, activity, counter, data, mayUseTemp = False):
501501
slot = data.findOpenSlotInModStreams(index, self.moduleID)
502502
slot.append(jsonModuleTransition(type=self.transition, id=self.index, modID=self.moduleID, callID=self.callID, activity=activity, start=self.time))
503503
return slot[-1]
504-
def _postJson(self, counter, data, injectAfter = None):
505-
compare = lambda x: x['id'] == self.index and x['mod'] == self.moduleID and x['call'] == self.callID and x['type'] == self.transition
504+
def _postJson(self, counter, data, injectAfter = None, isSrc = False):
505+
compare = lambda x: x['id'] == self.index and x['mod'] == self.moduleID and x['call'] == self.callID and x['type'] == self.transition and ((x.get('isSrc') != None) == isSrc )
506506
index = self.index
507507
if transitionIsGlobal(self.transition):
508508
item,slot = data.findLastInModGlobals(index, self.moduleID, compare)
@@ -582,28 +582,37 @@ def jsonInfo(self, counter, data):
582582
return self._postJson(counter,data)
583583

584584
class PreEDModuleEventDelayedGetParser(EDModuleTransitionParser):
585-
def __init__(self, payload, names):
585+
def __init__(self, payload, names, moduleCentric):
586586
super().__init__(payload, names)
587+
self._moduleCentric = moduleCentric
587588
def textSpecial(self):
588589
return "starting delayed get"
589590
def jsonInfo(self, counter, data):
590-
return self._preJson(Activity.delayedGet, counter,data)
591+
#a pre delayed get is effectively a post transition as the system assumes one state per module per transition instance
592+
if self._moduleCentric:
593+
#inject a dummy at end of the same slot to guarantee module run is in that slot
594+
return self._postJson(counter, data, jsonModuleTransition(type=self.transition, id=self.index, modID=self.moduleID, callID=self.callID, activity=Activity.temporary, start=self.time))
595+
return self._postJson(counter,data)
596+
#return self._preJson(Activity.delayedGet, counter,data)
591597

592598
class PostEDModuleEventDelayedGetParser(EDModuleTransitionParser):
593-
def __init__(self, payload, names):
599+
def __init__(self, payload, names, moduleCentric):
594600
super().__init__(payload, names)
601+
self._moduleCentric = moduleCentric
595602
def textSpecial(self):
596603
return "finished delayed get"
597604
def jsonInfo(self, counter, data):
598-
return self._postJson(counter,data)
605+
return self._preJson(Activity.process, counter,data, mayUseTemp=self._moduleCentric)
606+
#return self._postJson(counter,data)
599607

600608
class PreEventReadFromSourceParser(EDModuleTransitionParser):
601-
def __init__(self, payload, names):
609+
def __init__(self, payload, names, moduleCentric):
602610
super().__init__(payload, names)
611+
self._moduleCentric = moduleCentric
603612
def textSpecial(self):
604613
return "starting read from source"
605614
def jsonInfo(self, counter, data):
606-
slot = self._preJson(Activity.process, counter,data)
615+
slot = self._preJson(Activity.process, counter,data, mayUseTemp=self._moduleCentric, isSrc=True)
607616
slot['isSrc'] = True
608617
return slot
609618

@@ -613,7 +622,7 @@ def __init__(self, payload, names):
613622
def textSpecial(self):
614623
return "finished read from source"
615624
def jsonInfo(self, counter, data):
616-
return self._postJson(counter,data)
625+
return self._postJson(counter,data, isSrc=True)
617626

618627
class ESModuleTransitionParser(object):
619628
def __init__(self, payload, moduleNames, esModuleNames, recordNames):
@@ -747,11 +756,11 @@ def lineParserFactory (step, payload, moduleNames, esModuleNames, recordNames, f
747756
if step == 'a':
748757
return PostEDModuleAcquireParser(payload, moduleNames, moduleCentric)
749758
if step == 'D':
750-
return PreEDModuleEventDelayedGetParser(payload, moduleNames)
759+
return PreEDModuleEventDelayedGetParser(payload, moduleNames, moduleCentric)
751760
if step == 'd':
752-
return PostEDModuleEventDelayedGetParser(payload, moduleNames)
761+
return PostEDModuleEventDelayedGetParser(payload, moduleNames, moduleCentric)
753762
if step == 'R':
754-
return PreEventReadFromSourceParser(payload, moduleNames)
763+
return PreEventReadFromSourceParser(payload, moduleNames, moduleCentric)
755764
if step == 'r':
756765
return PostEventReadFromSourceParser(payload, moduleNames)
757766
if step == 'N':

0 commit comments

Comments
 (0)