CMS 3D CMS Logo

Classes | Functions
runall Namespace Reference

Classes

class  testit
 

Functions

def main (argv)
 

Function Documentation

def runall.main (   argv)

Definition at line 41 of file runall.py.

References createfilelist.int, harvestTrackValidationPlots.str, and digi_MixPreMix_cfi.strip.

41 def main(argv) :
42 
43  import getopt
44 
45  try:
46  opts, args = getopt.getopt(argv, "", ["nproc=","dohighstat",'hlt','inFile=','intbld'])
47  except getopt.GetoptError as e:
48  print "unknown option", str(e)
49  sys.exit(2)
50 
51 # check command line parameter
52  np=1
53  doHighStat=0
54  hlt = False
55  inFile = None
56  intBld = False
57  for opt, arg in opts :
58  if opt == "--inFile" :
59  inFile=arg
60  if opt == "--nproc" :
61  np=arg
62  if opt == "--dohighstat" :
63  doHighStat=1
64  if opt in ('--hlt',): # note: trailing comma needed for single arg to indicate tuple
65  hlt = True
66  if opt in ('--intbld',): # note: trailing comma needed for single arg to indicate tuple
67  intBld = True
68 
69  if hlt:
70  print "\nWARNING: option --hlt is deprecated as this is now default.\n"
71 
72  if inFile:
73  commands_standard_file=open(inFile,'r')
74  lines_standard=commands_standard_file.readlines()
75  commands_standard_file.close()
76  lines=lines_standard
77  else:
78  commands_standard_file=open('cmsDriver_standard_hlt.txt','r')
79  lines_standard=commands_standard_file.readlines()
80  commands_standard_file.close()
81  lines=lines_standard
82 
83  if doHighStat==1:
84  commands_highstat_file=open('cmsDriver_highstats_hlt.txt','r')
85  lines_highstat=commands_highstat_file.readlines()
86  commands_highstat_file.close()
87 
88  lines=lines+lines_highstat
89 
90 
91  # for the integration builds, check only these samples:
92  forIB = [ # from the standard_hlt:
93  'SingleMuPt10', 'SinglePiPt1', 'SingleElectronPt10', 'SingleGammaPt10',
94  'MinBias', 'QCD_Pt_80_120', 'ZEE', 'BJets_Pt_50_120','TTbar',
95  # from the highstats_hlt
96  'SinglePiE50HCAL', 'H130GGgluonfusion', 'QQH120Inv', 'bJpsiX',
97  'JpsiMM', 'BsMM', 'UpsMM', 'CJets_Pt_50_120'
98  ]
99 
100  commands=[]
101  for line in lines:
102  if ( line[0]!='#' and
103  line.replace(' ','')!='\n' ):
104  linecomponents=line.split('@@@')
105  if intBld and linecomponents[0].strip() not in forIB: continue
106  command=linecomponents[1][:-1]
107  commands.append(command)
108  print 'Will do: '+command
109 
110 
111  nfail=0
112  npass=0
113  report=''
114 
115  clist = []
116  cdone = []
117  i=0
118  print 'Running in %s thread(s)' %np
119 
120  for command in commands:
121  print 'Preparing to run %s' %command
122  current = testit(command)
123  clist.append(current)
124  cdone.append(0)
125  current.start()
126 
127  i=int(np)
128  while (int(i) >= int(np)):
129  i=0
130  time.sleep(10)
131  alen=len(cdone)
132  for j in range(0,alen):
133  mystat=cdone[j]
134  pingle=clist[j]
135  isA=pingle.isAlive()
136  if ( isA ): i+=1
137  if ( not isA and mystat==0 ):
138  nfail+=pingle.nfail
139  npass+=pingle.npass
140  report+=pingle.report
141  cdone[j]=1
142  print pingle.report
143 # print 'Number of running threads: %s' % i
144 
145  alen=len(cdone)
146  for j in range(0,alen):
147  pingle=clist[j]
148  mystat=cdone[j]
149  if ( mystat == 0 ):
150  pingle.join()
151  nfail+=pingle.nfail
152  npass+=pingle.npass
153  report+=pingle.report
154  print pingle.report
155 
156  report+='\n %s tests passed, %s failed \n' %(npass,nfail)
157  print report
158 
159  runall_report_name='runall-report.log'
160  runall_report=open(runall_report_name,'w')
161  runall_report.write(report)
162  runall_report.close()
163 
164  if hlt:
165  print "\nWARNING: option --hlt is deprecated as this is now default.\n"
166 
def main(argv)
Definition: runall.py:41