ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/RateMonShiftTool_dev/MenuChecker.py
Revision: 1.4
Committed: Sat Sep 29 20:18:50 2012 UTC (12 years, 7 months ago) by amott
Content type: text/x-python
Branch: MAIN
CVS Tags: V00-02-06, V00-02-05, V00-02-04, V00-02-03, HEAD
Changes since 1.3: +3 -2 lines
Log Message:
added DQM and stream B monitoring

File Contents

# Content
1 #!/usr/bin/env python
2
3 import os
4 import sys
5 import getopt
6 from MenuAnalyzer import MenuAnalyzer
7 from termcolor import colored, cprint
8
9 def usage():
10 print "Usage: "+sys.argv[0]+" <path to cdaq area>"
11 print "Options: "
12 print "-v Verbose mode (print out ALL checks)"
13 print "--doAnalysis=<analysis> Specify a specific check to so (default: do all)"
14
15 def main():
16 try:
17 opt, args = getopt.getopt(sys.argv[1:],"v",["doAnalysis="])
18
19 except getopt.GetoptError, err:
20 print str(err)
21 usage()
22 sys.exit(2)
23
24 if len(args)<1:
25 usage()
26 sys.exit()
27
28 menu = args[0]
29 verbose = False
30 toDo = []
31 for o,a in opt: # get options passed on the command line
32 if o=="-v":
33 Verbose = True
34 elif o=="--doAnalysis":
35 toDo.append(a)
36 else:
37 print "\nUnknown option "+o
38 sys.exit()
39
40
41 analyzer = MenuAnalyzer(menu)
42 if len(toDo)==0: analyzer.AddAllAnalyses()
43 else:
44 for a in toDo: analyzer.AddAnalysis(a)
45 analyzer.Analyze()
46
47 ## check the results
48 if not analyzer.expressType=='':
49 print "\nEXPRESS Reconstruction will be: %s" % analyzer.expressType
50 else:
51 print "WARNING: Cannot determine express reconstruction"
52
53 print "\n"
54 failed=[]
55 format = "ANALYSIS%26s %s"
56 pass_txt = colored("SUCCEEDED",'green')
57 fail_txt = colored("FAILED",'red')
58 for analysis,result in analyzer.Results.iteritems():
59 if isinstance(result,list): # list output
60 if len(result) == 0:
61 print format % (analysis,pass_txt,)
62 else:
63 print format % (analysis,fail_txt,)
64 failed.append(analysis)
65 else:
66 if result==0:
67 print format % (analysis,pass_txt,)
68 else:
69 print format % (analysis,fail_txt,)
70 failed.append(analysis)
71
72
73 if len(failed)!=0: print "\nLIST OF FAILED ANALYSES:"
74 for analysis in failed:
75 print analyzer.ProblemDescriptions[analysis]+": "
76 for line in analyzer.Results[analysis]: print line
77 print ""
78
79 if __name__=='__main__':
80 main()