2 |
|
from colors import * |
3 |
|
from DatabaseParser import * |
4 |
|
from termcolor import colored, cprint |
5 |
+ |
import time |
6 |
+ |
|
7 |
+ |
|
8 |
|
write = sys.stdout.write |
9 |
|
|
10 |
|
NHighExpress=0 |
12 |
|
|
13 |
|
def MoreTableInfo(parser,LumiRange,config,isCol=True): |
14 |
|
print "Monitoring Run %d" % (parser.RunNumber,) |
15 |
< |
print "len=",len(LumiRange) |
16 |
< |
print "LSRange=", LumiRange |
15 |
> |
localtime = time.asctime( time.localtime(time.time()) ) |
16 |
> |
print "Local current time :", localtime |
17 |
> |
#print "len=",len(LumiRange) |
18 |
> |
#print "Lumisections used=", LumiRange |
19 |
|
if len(LumiRange)>0: |
20 |
|
|
21 |
|
[AvInstLumi, AvLiveLumi, AvDeliveredLumi, AvDeadTime,PSCols] = parser.GetAvLumiInfo(LumiRange) |
22 |
|
deadtimebeamactive=parser.GetDeadTimeBeamActive(LumiRange)*100 |
23 |
+ |
|
24 |
|
##print "dtba=",deadtimebeamactive |
25 |
|
else: |
26 |
|
print "no lumisections to monitor" |
27 |
|
return |
28 |
+ |
|
29 |
+ |
try: |
30 |
+ |
#print "trying v3" |
31 |
+ |
lograte=parser.GetTriggerRatesByLS("HLT_LogMonitor_v3") |
32 |
+ |
#print lograte |
33 |
+ |
if not len(lograte): |
34 |
+ |
#print "trying v4" |
35 |
+ |
lograte=parser.GetTriggerRatesByLS("HLT_LogMonitor_v4") |
36 |
+ |
|
37 |
+ |
#print lograte |
38 |
+ |
for lumi in lograte.iterkeys(): |
39 |
+ |
#print lumi, lograte[lumi] |
40 |
+ |
if lograte[lumi]>config.MaxLogMonRate: |
41 |
+ |
write(bcolors.WARNING) |
42 |
+ |
print lograte[lumi], "post to elog. LogMonitor rate is high." |
43 |
+ |
write(bcolors.ENDC+"\n") |
44 |
+ |
except: |
45 |
+ |
write(bcolors.WARNING) |
46 |
+ |
print "problem getting log monitor rates" |
47 |
+ |
write(bcolors.ENDC+"\n") |
48 |
+ |
|
49 |
|
try: |
50 |
|
LastPSCol = PSCols[-1] |
51 |
|
except: |
53 |
|
if isCol: |
54 |
|
|
55 |
|
aRates = parser.GetTriggerRatesByLS("AOutput") |
56 |
+ |
aRatesPrompt = parser.GetTriggerRatesByLS("DQMOutput") |
57 |
|
bRates = parser.GetTriggerRatesByLS("BOutput") |
58 |
|
if len(bRates) == 0: |
59 |
|
realARates = aRates |
60 |
|
else: |
61 |
|
realARates={} |
62 |
|
for k,v in bRates.iteritems(): |
63 |
< |
realARates[k]=aRates[k]-bRates[k] |
63 |
> |
realARates[k]=aRates[k]-bRates[k]*20 |
64 |
|
#realARates = aRates - bRates*20; |
65 |
|
else: |
66 |
|
if len(parser.GetTriggerRatesByLS("AOutput"))>0: |
67 |
|
aRates = parser.GetTriggerRatesByLS("AOutput") |
68 |
+ |
bRates = parser.GetTriggerRatesByLS("BOutput") |
69 |
|
else: |
70 |
|
aRates = parser.GetTriggerRatesByLS("AForPPOutput") |
71 |
+ |
bRates = parser.GetTriggerRatesByLS("BForPPOutput") |
72 |
|
|
73 |
|
|
74 |
|
expressRates = {} |
88 |
|
AvgRateA=0 |
89 |
|
|
90 |
|
realARate=0 |
91 |
+ |
|
92 |
|
realPeakRateA=0 |
93 |
|
realAvgRateA=0 |
94 |
|
|
95 |
|
if len(expressRates.values()) > 20: |
96 |
|
AvgExpRate = sum(expressRates.values())/len(expressRates.values()) |
97 |
< |
|
97 |
> |
counter=0 |
98 |
|
for ls in LumiRange: ## Find the sum and peak express stream rates |
99 |
|
thisR = expressRates.get(ls,0) |
100 |
|
ExpRate+=thisR |
105 |
|
ARate+=thisRateA |
106 |
|
if thisRateA>PeakRateA: |
107 |
|
PeakRateA=thisRateA |
108 |
< |
|
109 |
< |
thisRealRateA = aRates.get(ls,0) - bRates.get(ls,0) |
108 |
> |
##print PSCols[counter] |
109 |
> |
if isCol: |
110 |
> |
if PSCols[counter]!=config.CircBeamCol: |
111 |
> |
thisRealRateA= aRatesPrompt.get(ls,0)*10 |
112 |
> |
else: |
113 |
> |
thisRealRateA = aRates.get(ls,0) - bRates.get(ls,0)*20 |
114 |
> |
else: |
115 |
> |
thisRealRateA = aRates.get(ls,0) - bRates.get(ls,0)*20 |
116 |
|
realARate+=thisRealRateA |
117 |
|
if thisRealRateA > realPeakRateA: |
118 |
|
realReakRateA = thisRealRateA |
119 |
+ |
counter=counter+1 |
120 |
|
#ARate+=aRates.get(ls,0) |
121 |
|
## Print Stream A Rate --moved see below |
122 |
|
##print "Current Steam A Rate is: %0.1f Hz" % (ARate/len(LumiRange),) |
124 |
|
Warn = False |
125 |
|
|
126 |
|
########################################## |
127 |
< |
## Check if the express stream is too high |
127 |
> |
## Check if the express stream is too high or low |
128 |
|
########################################## |
129 |
|
global NHighExpress |
130 |
< |
badExpress = ExpRate/len(LumiRange) > config.MaxExpressRate ## avg express stream rate too high? |
130 |
> |
badExpress = ((ExpRate/len(LumiRange) > config.MaxExpressRate) or (ExpRate/len(LumiRange)<0.1 and isCol)) ## avg express stream rate too high? |
131 |
|
baseText = "\nCurrent Express Stream rate is: %0.1f Hz" % (ExpRate/len(LumiRange),) ## text to display |
132 |
|
if badExpress: |
133 |
|
text = colored(baseText,'red',attrs=['reverse']) ## bad, make the text white on red |