CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
runall Namespace Reference

Classes

class  testit
 

Functions

def main
 

Function Documentation

def runall.main (   argv)

Definition at line 42 of file runall.py.

References print(), sistrip::SpyUtilities.range(), str, and digitizers_cfi.strip.

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