CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
addOnTests.StandardTester Class Reference
Inheritance diagram for addOnTests.StandardTester:

Public Member Functions

def __init__
 
def activeThreads
 
def dumpTest
 
def file2Path
 
def prepare
 
def runTests
 
def upload
 

Public Attributes

 commands
 
 devPath
 
 maxThreads
 
 relPath
 
 threadList
 

Detailed Description

Definition at line 64 of file addOnTests.py.

Constructor & Destructor Documentation

def addOnTests.StandardTester.__init__ (   self,
  nThrMax = 4 
)

Definition at line 66 of file addOnTests.py.

66 
67  def __init__(self, nThrMax=4):
68 
69  self.threadList = []
70  self.maxThreads = nThrMax
71  self.prepare()
72 
73  return

Member Function Documentation

def addOnTests.StandardTester.activeThreads (   self)

Definition at line 74 of file addOnTests.py.

References MatrixRunner.MatrixRunner.threadList, and addOnTests.StandardTester.threadList.

Referenced by addOnTests.StandardTester.runTests().

74 
75  def activeThreads(self):
76 
77  nActive = 0
78  for t in self.threadList:
79  if t.isAlive() : nActive += 1
80 
81  return nActive
def addOnTests.StandardTester.dumpTest (   self)

Definition at line 145 of file addOnTests.py.

References join().

146  def dumpTest(self):
147  print ",".join(self.commands.keys())
148  return
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def addOnTests.StandardTester.file2Path (   self,
  rFile 
)

Definition at line 149 of file addOnTests.py.

References addOnTests.StandardTester.devPath, and addOnTests.StandardTester.relPath.

150  def file2Path(self,rFile):
151 
152  fullPath = self.relPath + rFile
153  if os.path.exists(self.devPath + rFile): fullPath = self.devPath + rFile
154  return fullPath
def addOnTests.StandardTester.prepare (   self)

Definition at line 82 of file addOnTests.py.

82 
83  def prepare(self):
84 
85  self.devPath = os.environ['LOCALRT'] + '/src/'
86  self.relPath = self.devPath
87  if 'CMSSW_RELEASE_BASE' in os.environ and (os.environ['CMSSW_RELEASE_BASE'] != ""): self.relPath = os.environ['CMSSW_RELEASE_BASE'] + '/src/'
88 
89  lines = { 'read312RV' : ['cmsRun '+self.file2Path('Utilities/ReleaseScripts/scripts/read312RV_cfg.py')],
90  'fastsim' : ["cmsDriver.py TTbar_8TeV_TuneCUETP8M1_cfi --conditions auto:run1_mc --fast -n 100 --eventcontent AODSIM,DQM --relval 100000,1000 -s GEN,SIM,RECOBEFMIX,DIGI:pdigi_valid,L1,DIGI2RAW,L1Reco,RECO,EI,HLT:@fake,VALIDATION --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --datatier GEN-SIM-DIGI-RECO,DQMIO --beamspot Realistic8TeVCollision"],
91  'fastsim1' : ["cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi --conditions auto:run2_mc --fast -n 100 --eventcontent AODSIM,DQM --relval 100000,1000 -s GEN,SIM,RECOBEFMIX,DIGI:pdigi_valid,L1,DIGI2RAW,L1Reco,RECO,EI,HLT:@relval25ns,VALIDATION --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --datatier GEN-SIM-DIGI-RECO,DQMIO --beamspot NominalCollision2015 --era Run2_25ns --magField 38T_PostLS1"],
92  'fastsim2' : ["cmsDriver.py TTbar_13TeV_TuneCUETP8M1_cfi --conditions auto:run2_mc --fast -n 100 --eventcontent AODSIM,DQM --relval 100000,1000 -s GEN,SIM,RECOBEFMIX,DIGI:pdigi_valid,L1,DIGI2RAW,L1Reco,RECO,EI,HLT:@relval2016,VALIDATION --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --datatier GEN-SIM-DIGI-RECO,DQMIO --beamspot NominalCollision2015 --era Run2_2016 --magField 38T_PostLS1"],
93  'pat1' : ['cmsRun '+self.file2Path('PhysicsTools/PatAlgos/test/IntegrationTest_cfg.py')],
94  }
95 
96  hltFlag_data = ' realData=True globalTag=@ inputFiles=@ '
97  hltFlag_mc = ' realData=False globalTag=@ inputFiles=@ '
98 
99  hltTests = {
100  'hlt_mc_Fake' : ['cmsDriver.py TTbar_Tauola_8TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --fileout file:RelVal_Raw_Fake_MC.root',
101  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_Fake.py')+hltFlag_mc,
102  'cmsDriver.py RelVal -s HLT:Fake,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run1_mc_Fake --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_Fake_MC.root --fileout file:RelVal_Raw_Fake_MC_HLT_RECO.root'],
103  'hlt_mc_Fake1': ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake1 --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_25ns --fileout file:RelVal_Raw_Fake1_MC.root',
104  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_Fake1.py')+hltFlag_mc,
105  'cmsDriver.py RelVal -s HLT:Fake1,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_Fake1 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_25ns --processName=HLTRECO --filein file:RelVal_Raw_Fake1_MC.root --fileout file:RelVal_Raw_Fake1_MC_HLT_RECO.root'],
106  'hlt_mc_GRun' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_GRun --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --magField 38T_PostLS1 --fileout file:RelVal_Raw_GRun_MC.root',
107  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_GRun.py')+hltFlag_mc,
108  'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_GRun_MC.root --fileout file:RelVal_Raw_GRun_MC_HLT_RECO.root'],
109  'hlt_mc_HIon' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=HeavyIons -n 10 --conditions auto:run2_mc_HIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016,Run2_HI --magField 38T_PostLS1 --fileout file:RelVal_Raw_HIon_MC.root',
110  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_HIon.py')+hltFlag_mc,
111  'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --mc --scenario=HeavyIons -n 10 --conditions auto:run2_mc_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016,Run2_HI --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_HIon_MC.root --fileout file:RelVal_Raw_HIon_MC_HLT_RECO.root'],
112  'hlt_mc_PIon' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_PIon --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --magField 38T_PostLS1 --fileout file:RelVal_Raw_PIon_MC.root',
113  'cmsRun ' + self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_PIon.py')+hltFlag_mc,
114  'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_PIon_MC.root --fileout file:RelVal_Raw_PIon_MC_HLT_RECO.root'],
115  'hlt_mc_PRef' : ['cmsDriver.py TTbar_Tauola_13TeV_TuneCUETP8M1_cfi -s GEN,SIM,DIGI,L1,DIGI2RAW --mc --scenario=pp -n 10 --conditions auto:run2_mc_PRef --relval 9000,50 --datatier "GEN-SIM-RAW" --eventcontent RAWSIM --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --magField 38T_PostLS1 --fileout file:RelVal_Raw_PRef_MC.root',
116  'cmsRun ' + self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_PRef.py')+hltFlag_mc,
117  'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --mc --scenario=pp -n 10 --conditions auto:run2_mc_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_PRef_MC.root --fileout file:RelVal_Raw_PRef_MC_HLT_RECO.root'],
118  'hlt_data_Fake' : ['cmsDriver.py RelVal -s L1REPACK:GT1 --data --scenario=pp -n 10 --conditions auto:run1_hlt_Fake --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --fileout file:RelVal_Raw_Fake_DATA.root --filein /store/data/Run2012A/MuEG/RAW/v1/000/191/718/14932935-E289-E111-830C-5404A6388697.root',
119  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_Fake.py')+hltFlag_data,
120  'cmsDriver.py RelVal -s HLT:Fake,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run1_data_Fake --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --processName=HLTRECO --filein file:RelVal_Raw_Fake_DATA.root --fileout file:RelVal_Raw_Fake_DATA_HLT_RECO.root'],
121  'hlt_data_Fake1': ['cmsDriver.py RelVal -s L1REPACK:GCTGT --data --scenario=pp -n 10 --conditions auto:run2_hlt_Fake1 --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_25ns --fileout file:RelVal_Raw_Fake1_DATA.root --filein /store/data/Run2015D/MuonEG/RAW/v1/000/256/677/00000/80950A90-745D-E511-92FD-02163E011C5D.root',
122  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_Fake1.py')+hltFlag_data,
123  'cmsDriver.py RelVal -s HLT:Fake1,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_Fake1 --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_25ns --processName=HLTRECO --filein file:RelVal_Raw_Fake1_DATA.root --fileout file:RelVal_Raw_Fake1_DATA_HLT_RECO.root'],
124  'hlt_data_GRun' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run2_hlt_GRun --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --magField 38T_PostLS1 --fileout file:RelVal_Raw_GRun_DATA.root --filein /store/data/Run2016B/JetHT/RAW/v1/000/272/762/00000/C666CDE2-E013-E611-B15A-02163E011DBE.root',
125  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_GRun.py')+hltFlag_data,
126  'cmsDriver.py RelVal -s HLT:GRun,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_GRun --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_25ns --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_GRun_DATA.root --fileout file:RelVal_Raw_GRun_DATA_HLT_RECO.root'],
127  'hlt_data_HIon' : ['cmsDriver.py RelVal -s L1REPACK:Full2015Data --data --scenario=HeavyIons -n 10 --conditions auto:run2_hlt_HIon --relval 9000,50 --datatier "RAW" --eventcontent RAW --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016,Run2_HI --magField 38T_PostLS1 --fileout file:RelVal_Raw_HIon_DATA.root --filein /store/hidata/HIRun2015/HIHardProbes/RAW-RECO/HighPtJet-PromptReco-v1/000/263/689/00000/1802CD9A-DDB8-E511-9CF9-02163E0138CA.root',
128  'cmsRun '+self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_HIon.py')+hltFlag_data,
129  'cmsDriver.py RelVal -s HLT:HIon,RAW2DIGI,L1Reco,RECO --data --scenario=HeavyIons -n 10 --conditions auto:run2_data_HIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016,Run2_HI --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_HIon_DATA.root --fileout file:RelVal_Raw_HIon_DATA_HLT_RECO.root'],
130  'hlt_data_PIon' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run2_hlt_PIon --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --magField 38T_PostLS1 --eventcontent RAW --fileout file:RelVal_Raw_PIon_DATA.root --filein /store/data/Run2016B/JetHT/RAW/v1/000/272/762/00000/C666CDE2-E013-E611-B15A-02163E011DBE.root',
131  'cmsRun ' + self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_PIon.py')+hltFlag_data,
132  'cmsDriver.py RelVal -s HLT:PIon,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_PIon --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_PIon_DATA.root --fileout file:RelVal_Raw_PIon_DATA_HLT_RECO.root'],
133  'hlt_data_PRef' : ['cmsDriver.py RelVal -s L1REPACK:Full --data --scenario=pp -n 10 --conditions auto:run2_hlt_PRef --relval 9000,50 --datatier "RAW" --customise=HLTrigger/Configuration/CustomConfigs.L1T --era Run2_2016 --magField 38T_PostLS1 --eventcontent RAW --fileout file:RelVal_Raw_PRef_DATA.root --filein /store/data/Run2016B/JetHT/RAW/v1/000/272/762/00000/C666CDE2-E013-E611-B15A-02163E011DBE.root',
134  'cmsRun ' + self.file2Path('HLTrigger/Configuration/test/OnLine_HLT_PRef.py')+hltFlag_data,
135  'cmsDriver.py RelVal -s HLT:PRef,RAW2DIGI,L1Reco,RECO --data --scenario=pp -n 10 --conditions auto:run2_data_PRef --relval 9000,50 --datatier "RAW-HLT-RECO" --eventcontent FEVTDEBUGHLT --customise=HLTrigger/Configuration/CustomConfigs.L1THLT --era Run2_2016 --magField 38T_PostLS1 --processName=HLTRECO --filein file:RelVal_Raw_PRef_DATA.root --fileout file:RelVal_Raw_PRef_DATA_HLT_RECO.root'],
136  }
138  self.commands={}
139  for dirName, command in lines.items():
140  self.commands[dirName] = command
141 
142  for dirName, commandList in hltTests.items():
143  self.commands[dirName] = commandList
144  return
def addOnTests.StandardTester.runTests (   self,
  testList = None 
)

Definition at line 155 of file addOnTests.py.

References MatrixRunner.MatrixRunner.activeThreads(), addOnTests.StandardTester.activeThreads(), o2oMgr.CommandTool.commands, addOnTests.StandardTester.commands, MatrixRunner.MatrixRunner.maxThreads, addOnTests.StandardTester.maxThreads, MatrixRunner.MatrixRunner.threadList, and addOnTests.StandardTester.threadList.

156  def runTests(self, testList = None):
157 
158  actDir = os.getcwd()
159 
160  if not os.path.exists('addOnTests'):
161  os.makedirs('addOnTests')
162  os.chdir('addOnTests')
163 
164  nfail=0
165  npass=0
166  report=''
167 
168  print 'Running in %s thread(s)' % self.maxThreads
169 
170  for dirName, command in self.commands.items():
171 
172  if testList and not dirName in testList:
173  del self.commands[dirName]
174  continue
175 
176  # make sure we don't run more than the allowed number of threads:
177  while self.activeThreads() >= self.maxThreads:
178  time.sleep(10)
179  continue
180 
181  print 'Preparing to run %s' % str(command)
182  current = testit(dirName, command)
183  self.threadList.append(current)
184  current.start()
185  time.sleep(random.randint(1,5)) # try to avoid race cond by sleeping random amount of time [1,5] sec
186 
187  # wait until all threads are finished
188  while self.activeThreads() > 0:
189  time.sleep(5)
190 
191  # all threads are done now, check status ...
192  for pingle in self.threadList:
193  pingle.join()
194  for f in pingle.nfail: nfail += f
195  for p in pingle.npass: npass += p
196  report += pingle.report
197  print pingle.report
198  sys.stdout.flush()
199 
200  reportSumm = '\n %s tests passed, %s failed \n' %(npass,nfail)
201  print reportSumm
202 
203  runall_report_name='runall-report.log'
204  runall_report=open(runall_report_name,'w')
205  runall_report.write(report+reportSumm)
206  runall_report.close()
207 
208  # get the logs to the logs dir:
209  print '==> in :', os.getcwd()
210  print ' going to copy log files to logs dir ...'
211  if not os.path.exists('logs'):
212  os.makedirs('logs')
213  for dirName in self.commands:
214  cmd = "for L in `ls "+dirName+"/*.log`; do cp $L logs/cmsDriver-`dirname $L`_`basename $L` ; done"
215  print "going to ",cmd
216  os.system(cmd)
217 
218  import pickle
219  pickle.dump(self.commands, open('logs/addOnTests.pkl', 'w') )
220 
221  os.chdir(actDir)
222 
223  return
def addOnTests.StandardTester.upload (   self,
  tgtDir 
)

Definition at line 224 of file addOnTests.py.

225  def upload(self, tgtDir):
226 
227  print "in ", os.getcwd()
228 
229  if not os.path.exists(tgtDir):
230  os.makedirs(tgtDir)
231 
232  cmd = 'tar cf - addOnTests.log addOnTests/logs | (cd '+tgtDir+' ; tar xf - ) '
233  try:
234  print 'executing: ',cmd
235  ret = os.system(cmd)
236  if ret != 0:
237  print "ERROR uploading logs:", ret, cmd
238  except Exception as e:
239  print "EXCEPTION while uploading addOnTest-logs : ", str(e)
240 
241  return
242 

Member Data Documentation

addOnTests.StandardTester.commands

Definition at line 137 of file addOnTests.py.

Referenced by addOnTests.StandardTester.runTests().

addOnTests.StandardTester.devPath

Definition at line 84 of file addOnTests.py.

Referenced by addOnTests.StandardTester.file2Path().

addOnTests.StandardTester.maxThreads

Definition at line 69 of file addOnTests.py.

Referenced by addOnTests.StandardTester.runTests().

addOnTests.StandardTester.relPath

Definition at line 85 of file addOnTests.py.

Referenced by addOnTests.StandardTester.file2Path().

addOnTests.StandardTester.threadList

Definition at line 68 of file addOnTests.py.

Referenced by addOnTests.StandardTester.activeThreads(), and addOnTests.StandardTester.runTests().