CMS 3D CMS Logo

Classes | Functions | Variables
showPage Namespace Reference

Classes

class  BuildViewer
 

Functions

def addDash (table, ruleNr)
 
def createLogFiles (rulesResult, logsDir, ib)
 
def getIB (pathIn)
 
def main ()
 
def numberConverter (number)
 
def run (pickleDir, logsDir, htmlDir)
 

Variables

 __author__
 
 __date__
 

Function Documentation

◆ addDash()

def showPage.addDash (   table,
  ruleNr 
)

Definition at line 128 of file showPage.py.

128 def addDash(table, ruleNr):
129  for index, tableRow in enumerate(table):
130  if len(tableRow)-1 != ruleNr + 1:
131  table[index] = table[index] + ('-',)
132 

Referenced by showPage.BuildViewer.showResults().

◆ createLogFiles()

def showPage.createLogFiles (   rulesResult,
  logsDir,
  ib 
)

Definition at line 140 of file showPage.py.

140 def createLogFiles(rulesResult, logsDir, ib):
141  logDir = join(logsDir,"logs")
142  if os.path.exists(logDir):
143  rmtree(logDir)
144  for ruleName in rulesNames:
145  try:
146  ruleResult = rulesResult[ruleName]
147  for package, packageResult in ruleResult:
148  logsDir = join(logDir, package)
149  if not os.path.exists(logsDir): os.makedirs(logsDir, 0o755)
150  file = open(join(logsDir, "log.html"), 'a')
151  file.write('Rule %s'%ruleName)
152  file.write("<br/>")
153  for path, lineNumbers in packageResult:
154  for line in lineNumbers:
155  directory = join(package, path)
156  file.write('<a href="https://cmssdt.cern.ch/lxr/source/%s?v=%s#%s">%s:%s</a>\n'%(directory, ib, numberConverter(line), directory, line))
157  file.write("<br/>")
158  file.write('\n')
159  file.close()
160  except KeyError:
161  pass
162 

References join(), and numberConverter().

Referenced by showPage.BuildViewer.showResults().

◆ getIB()

def showPage.getIB (   pathIn)

Definition at line 19 of file showPage.py.

19 def getIB(pathIn):
20 
21  ib = None
22  wkDay = None
23  dirs = os.path.abspath(pathIn).split('/')
24  for item in dirs:
25  if item.startswith('CMSSW_'):
26  ib = item
27  break
28 
29  if ib:
30  import datetime
31  fooYr, m, d, hr = ib.split('-')
32  wkDay = datetime.date( int(fooYr[-4:]), int(m), int(d) ).strftime("%a")
33 
34  return ib, wkDay
35 

References createfilelist.int, and submitPVValidationJobs.split().

Referenced by showPage.BuildViewer.showResults().

◆ main()

def showPage.main ( )

Definition at line 207 of file showPage.py.

207 def main():
208 
209  parser = OptionParser()
210  parser.add_option("-l", "-L", dest="logDir", help = "creates log files to DIRECTORY", metavar = "DIRECTORY", default = os.getcwd())
211  parser.add_option("-p", "-P", dest="pickleDir", help = "reads pickle files from DIRECTORY", metavar = "DIRECTORY", default = os.getcwd())
212  parser.add_option("-c", "-C", dest="htmlDir", help = "creates cmsCRPage.html file to DIRECTORY", metavar = "DIRECTORY", default = os.getcwd())
213  (options, args) = parser.parse_args()
214 
215  logsDir = options.logDir
216  pickleDir = options.pickleDir
217  htmlDir = options.htmlDir
218 
219  if not os.path.exists(logsDir):
220  print("Error: wrong directory %s"%logsDir)
221  return
222 
223  if not os.path.exists(pickleDir):
224  print("Error: wrong directory %s"%pickleDir)
225  return
226 
227  if not os.path.exists(htmlDir):
228  print("Error: wrong directory %s"%htmlDir)
229  return
230 
231  run(pickleDir, logsDir, htmlDir)
232 
233  return
234 

References print(), and run().

◆ numberConverter()

def showPage.numberConverter (   number)

Definition at line 133 of file showPage.py.

133 def numberConverter(number):
134  number = str(number)
135  length = len(number)
136  if length < 3:
137  number = (3-length)*str(0) + number
138  return number
139 

References str.

Referenced by createLogFiles().

◆ run()

def showPage.run (   pickleDir,
  logsDir,
  htmlDir 
)

Definition at line 163 of file showPage.py.

163 def run(pickleDir, logsDir, htmlDir):
164  aoSorting = ""
165  for i in range(len(ordering)):
166  aoSorting += "["+ str(i+1) +",'desc'],"
167  aoSorting += "[0, 'asc']"
168 
169  style = """
170 
171  <style type="text/css" title="currentStyle">
172  @import "/SDT/html/jsExt/dataTables/media/css/demo_table.css";
173  </style>
174 
175  <script type="text/javascript" src="/SDT/html/jsExt/dataTables/media/js/jquery.js"></script>
176  <script type="text/javascript" src="/SDT/html/jsExt/dataTables/media/js/jquery.dataTables.js"></script>
177 
178  <script type="text/javascript" charset="utf-8">
179  /* Initialise the table with the required column sorting data types */
180  $(document).ready(function() {
181  $('#mainTable').dataTable( {
182  "oLanguage": {
183  "sLengthMenu": "Display _MENU_ records per page",
184  "sInfoEmpty": "Showing 0 to 0 of 0 records"
185  },
186  "aaSorting": [%s]
187  } );
188  $('#descriptionTable').dataTable( {
189  "aaSorting": [[0, 'asc']],
190  "bPaginate": false,
191  "bLengthChange": false,
192  "bFilter": false,
193  "bSort": false,
194  "bInfo": false,
195  "bAutoWidth": false
196  });
197  $('#descriptionTable thead th').css({'border-bottom': '1px solid black'});
198  } );
199  </script>
200  """%(aoSorting)
201 
202  fmtr = SimpleHTMLFormatter(title="CMSSW integration builds", style=style, outFile = open(join(htmlDir,"cmsCRPage.html"), "w"))
203 
204  bv = BuildViewer(fmtr, pickleDir, logsDir, htmlDir)
205  bv.showResults()
206 

References join(), FastTimerService_cff.range, and str.

Referenced by main().

Variable Documentation

◆ __author__

showPage.__author__
private

Definition at line 5 of file showPage.py.

◆ __date__

showPage.__date__
private

Definition at line 6 of file showPage.py.

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
showPage.createLogFiles
def createLogFiles(rulesResult, logsDir, ib)
Definition: showPage.py:140
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
showPage.numberConverter
def numberConverter(number)
Definition: showPage.py:133
submitPVValidationJobs.split
def split(sequence, size)
Definition: submitPVValidationJobs.py:352
str
#define str(s)
Definition: TestProcessor.cc:51
showPage.main
def main()
Definition: showPage.py:207
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
createfilelist.int
int
Definition: createfilelist.py:10
showPage.run
def run(pickleDir, logsDir, htmlDir)
Definition: showPage.py:163
showPage.getIB
def getIB(pathIn)
Definition: showPage.py:19
showPage.addDash
def addDash(table, ruleNr)
Definition: showPage.py:128