CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
addOnTests.testit Class Reference
Inheritance diagram for addOnTests.testit:

Public Member Functions

def __init__ (self, dirName, commandList)
 
def run (self)
 

Public Attributes

 commandList
 
 dirName
 
 nfail
 
 npass
 
 report
 
 status
 

Detailed Description

Definition at line 16 of file addOnTests.py.

Constructor & Destructor Documentation

◆ __init__()

def addOnTests.testit.__init__ (   self,
  dirName,
  commandList 
)

Definition at line 17 of file addOnTests.py.

17  def __init__(self,dirName, commandList):
18  Thread.__init__(self)
19  self.dirName = dirName
20  self.commandList = commandList
21  self.status=-1
22  self.report=''
23  self.nfail=[]
24  self.npass=[]
25 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ run()

def addOnTests.testit.run (   self)

Definition at line 26 of file addOnTests.py.

References mps_setup.append, addOnTests.testit.commandList, addOnTests.testit.dirName, analyzer.Analyzer.dirName, MuonIsolationDQM.dirName, VariablePlotter::SubDirectory.dirName, VariablePlotter::Directory.dirName, runall.testit.nfail, WorkFlowRunner.WorkFlowRunner.nfail, addOnTests.testit.nfail, TShapeAnalysis.npass, runall.testit.npass, WorkFlowRunner.WorkFlowRunner.npass, addOnTests.testit.npass, runall.testit.report, WorkFlowRunner.WorkFlowRunner.report, addOnTests.testit.report, ALIUtils.report, dataset.BaseDataset.report, and dataset.Dataset.report.

26  def run(self):
27  try:
28  os.makedirs(self.dirName)
29  except:
30  pass
31 
32  with open(self.dirName+'/cmdLog', 'w') as clf:
33  clf.write(f'# {self.dirName}\n')
34 
35  for cmdIdx, command in enumerate(self.commandList):
36  clf.write(f'\n{command}\n')
37 
38  time_start = time.time()
39  exitcode = os.system(f'cd {self.dirName} && {command} > step{cmdIdx+1}.log 2>&1')
40  time_elapsed_sec = round(time.time() - time_start)
41 
42  timelog = f'elapsed time: {time_elapsed_sec} sec (ended on {time.asctime()})'
43  logline = f'[{self.dirName}:{cmdIdx+1}] {command} : '
44  if exitcode != 0:
45  logline += 'FAILED'
46  self.nfail.append(1)
47  self.npass.append(0)
48  else:
49  logline += 'PASSED'
50  self.nfail.append(0)
51  self.npass.append(1)
52  logline += f' - {timelog} - exit: {exitcode}'
53  self.report += logline+'\n\n'
54 

Member Data Documentation

◆ commandList

addOnTests.testit.commandList

Definition at line 20 of file addOnTests.py.

Referenced by addOnTests.testit.run().

◆ dirName

addOnTests.testit.dirName

Definition at line 19 of file addOnTests.py.

Referenced by addOnTests.testit.run(), and core.JSONAnalyzer.JSONAnalyzer.write().

◆ nfail

addOnTests.testit.nfail

Definition at line 23 of file addOnTests.py.

Referenced by addOnTests.testit.run().

◆ npass

addOnTests.testit.npass

Definition at line 24 of file addOnTests.py.

Referenced by addOnTests.testit.run().

◆ report

addOnTests.testit.report

Definition at line 22 of file addOnTests.py.

Referenced by addOnTests.testit.run().

◆ status

addOnTests.testit.status