CMS 3D CMS Logo

Classes | Functions
runall Namespace Reference

Classes

class  testit
 

Functions

def main (argv)
 

Function Documentation

◆ main()

def runall.main (   argv)

Definition at line 42 of file runall.py.

References createfilelist.int, print(), isotrackApplyRegressor.range, str, and nano_mu_digi_cff.strip.

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