CMS 3D CMS Logo

runall Namespace Reference


Classes

class  testit

Functions

def main


Function Documentation

def runall::main (   argv  ) 

Definition at line 41 of file runall.py.

00041                :
00042 
00043     import getopt
00044     
00045     try:
00046         opts, args = getopt.getopt(argv, "", ["nproc=","dohighstat",'hlt','inFile=','intbld'])
00047     except getopt.GetoptError, e:
00048         print "unknown option", str(e)
00049         sys.exit(2)
00050         
00051 # check command line parameter
00052     np=1
00053     doHighStat=0
00054     hlt = False
00055     inFile = None
00056     intBld = False
00057     for opt, arg in opts :
00058         if opt == "--inFile" :
00059             inFile=arg
00060         if opt == "--nproc" :
00061             np=arg
00062         if opt == "--dohighstat" :
00063             doHighStat=1
00064         if opt in ('--hlt',): # note: trailing comma needed for single arg to indicate tuple
00065             hlt = True
00066         if opt in ('--intbld',): # note: trailing comma needed for single arg to indicate tuple
00067             intBld = True
00068 
00069     if hlt:
00070         print "\nWARNING: option --hlt is deprecated as this is now default.\n"
00071 
00072     if inFile:
00073         commands_standard_file=open(inFile,'r')
00074         lines_standard=commands_standard_file.readlines()
00075         commands_standard_file.close()
00076         lines=lines_standard
00077     else:
00078         commands_standard_file=open('cmsDriver_standard_hlt.txt','r')
00079         lines_standard=commands_standard_file.readlines()
00080         commands_standard_file.close()
00081         lines=lines_standard
00082 
00083         if doHighStat==1:
00084             commands_highstat_file=open('cmsDriver_highstats_hlt.txt','r')
00085             lines_highstat=commands_highstat_file.readlines()
00086             commands_highstat_file.close()
00087 
00088             lines=lines+lines_highstat
00089    
00090 
00091     # for the integration builds, check only these samples:
00092     forIB = [ # from the standard_hlt:
00093              'SingleMuPt10', 'SinglePiPt1', 'SingleElectronPt10', 'SingleGammaPt10',
00094              'MinBias', 'QCD_Pt_80_120', 'ZEE', 'BJets_Pt_50_120','TTbar',
00095              # from the highstats_hlt
00096              'SinglePiE50HCAL', 'H130GGgluonfusion', 'QQH120Inv', 'bJpsiX', 
00097              'JpsiMM', 'BsMM', 'UpsMM', 'CJets_Pt_50_120'
00098              ]
00099     
00100     commands=[]
00101     for line in lines:
00102         if ( line[0]!='#' and
00103            line.replace(' ','')!='\n' ):
00104                linecomponents=line.split('@@@')
00105                if intBld and linecomponents[0].strip() not in forIB: continue
00106                command=linecomponents[1][:-1]
00107                commands.append(command)
00108                print 'Will do: '+command
00109         
00110 
00111     nfail=0
00112     npass=0
00113     report=''
00114 
00115     clist = []
00116     cdone = []
00117     i=0
00118     print 'Running in %s thread(s)' %np
00119 
00120     for command in commands:
00121         print 'Preparing to run %s' %command 
00122         current = testit(command)
00123         clist.append(current)
00124         cdone.append(0)
00125         current.start()
00126 
00127         i=int(np)
00128         while (int(i) >= int(np)): 
00129             i=0
00130             time.sleep(10)
00131             alen=len(cdone)
00132             for j in range(0,alen):
00133                 mystat=cdone[j]
00134                 pingle=clist[j]
00135                 isA=pingle.isAlive()
00136                 if ( isA ): i+=1
00137                 if ( not isA and mystat==0 ): 
00138                     nfail+=pingle.nfail
00139                     npass+=pingle.npass
00140                     report+=pingle.report
00141                     cdone[j]=1
00142                     print pingle.report
00143 #            print 'Number of running threads: %s' % i        
00144 
00145     alen=len(cdone)
00146     for j in range(0,alen):
00147         pingle=clist[j]
00148         mystat=cdone[j]
00149         if ( mystat == 0 ):  
00150             pingle.join()
00151             nfail+=pingle.nfail
00152             npass+=pingle.npass
00153             report+=pingle.report
00154             print pingle.report
00155         
00156     report+='\n %s tests passed, %s failed \n' %(npass,nfail)
00157     print report
00158     
00159     runall_report_name='runall-report.log'
00160     runall_report=open(runall_report_name,'w')
00161     runall_report.write(report)
00162     runall_report.close()
00163     
00164     if hlt:
00165         print "\nWARNING: option --hlt is deprecated as this is now default.\n"
00166 
if __name__ == '__main__' :


Generated on Tue Jun 9 18:52:32 2009 for CMSSW by  doxygen 1.5.4