CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
results_mgr.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import sys
3 import getopt
4 import common_db
5 import results_db
6 import reference_db
7 
8 def CmdUsage():
9  print "Command line arguments :"
10  print "--read_sel (-S) --full (-f) -i [runid] -l [test_label] -c [ cand_release:arch]: read the content of the results db"
11  print "--read (-R): read the content of the results db) db"
12  print "--del (-D) -i [runid] : delete the result entry for the run"
13 
14 try:
15  opts, args = getopt.getopt(sys.argv[1:], "SRFDi:l:c:h", ['read_sel', 'read','full','del','help'])
16 except getopt.GetoptError, err:
17  # print help information and exit:
18  print str(err) # will print something like "option -a not recognized"
19  CmdUsage()
20  sys.exit(2)
21 rflag = False
22 sflag = False
23 fflag = False
24 dflag = False
25 T_LABEL = None
26 RUNID = None
27 CRELEASE = None
28 RRELEASE = None
29 if( len(opts)==0 ):
30  CmdUsage()
31  sys.exit(2)
32 for o, a in opts:
33  if o in ("--read","-R" ):
34  rflag = True
35  elif o in ("--read_sel","-S" ):
36  sflag = True
37  elif o in ("--full","-F" ):
38  fflag = True
39  elif o in ("--del","-D" ):
40  dflag = True
41  elif o == "-l":
42  T_LABEL = a
43  elif o == "-i":
44  RUNID = a
45  elif o == "-c":
46  CRELEASE = a
47  elif o in ("--help","-h"):
48  CmdUsage()
49  sys.exit(2)
50  else:
51  assert False, "unhandled option"
52 
54 resDb = results_db.ResultsDB( conn )
55 
56 mainOption = False
57 if(rflag == True):
58  resDb.read()
59 elif(sflag == True):
60  crel = None
61  carch = None
62  if( CRELEASE != None ):
63  tok = CRELEASE.split(":")
64  crel = tok[0]
65  carch = tok[1]
66  rrel = None
67  rarch = None
68  resDb.readSelection( RUNID, T_LABEL, crel, carch, fflag )
69 elif( dflag == True ):
70  if( RUNID == None ):
71  print 'ERROR: runid has not been provided.'
72  else:
73  resDb.deleteRun( RUNID )
74 
75 conn.close()
def CmdUsage
Definition: results_mgr.py:8
def createDBConnection
Definition: common_db.py:32
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31