CMS 3D CMS Logo

cmsPerfPublish Namespace Reference


Classes

class  ReldirExcept
class  Row
class  Table

Functions

def addtrailingslash
def copytree4
def createCandlHTML
def createHTMLtab
def createRegressHTML
def createWebReports
def delTmpDir
def dirname_cmp
def docopy
def fail
def get_environ
def getcmd
def getcmdBasic
def getDate
def getDirnameDirs
def getNumOfEventsFromLog
def getOutputNames
def getRelativeDir
def getStageRepDirs
def logrep_cmp
def main
def optionparse
def populateFromTupleRoot
def prettySize
def print_header
def reg_dirname_cmp
def rootfile_cmp
def scanReportArea
def step_cmp
def syncToRemoteLoc
def syscp
def timerep_cmp

Variables

int CallgrindNumOfEvents = 9999
tuple cpDirFilter = ( )
tuple cpFileFilter = ( "*.root", )
string DEF_RELVAL = "/afs/cern.ch/cms/sdt/web/performance/RelVal"
string DEF_SIMUL = "/afs/cern.ch/cms/sdt/web/performance/simulation"
tuple DirName
int IgProfNumOfEvents = 9999
int MemcheckNumOfEvents = 9999
tuple PROG_NAME = os.path.basename(sys.argv[0])
tuple Steps = set(Step+ProductionSteps)
int TimeSizeNumOfEvents = 9999
string TMP_DIR = ""


Function Documentation

def cmsPerfPublish::addtrailingslash (   adir  ) 

Definition at line 63 of file cmsPerfPublish.py.

00063                           :
00064     trail = re.compile("/$")
00065     if os.path.isdir(adir) and not trail.search(adir):
00066         adir = adir + "/" 
00067     return adir
00068 
def getDate():

def cmsPerfPublish::copytree4 (   src,
  dest,
  keepTop = True 
)

Definition at line 1736 of file cmsPerfPublish.py.

01736                                     :
01737     def _getNewLocation(source,child,dst,keepTop=keepTop):
01738         place = getRelativeDir(source,child,keepTop=keepTop)
01739         return os.path.join(dst,place)
01740     def _copyFilter(source,dst,curdir,fsnodes,filter,dirs=False):
01741         for node in fsnodes:
01742             dontFilter = True
01743             filterExist = not len(filter) == 0
01744             if filterExist:
01745                 dontFilter = not reduce(lambda x,y: x or y,map(lambda x: fnmatch.fnmatch(node,x),filter))
01746             if dontFilter:
01747                 node = os.path.join(curdir,node) # convert to absolute path
01748                 try:
01749                     newnode = _getNewLocation(source,node,dst)
01750                     if dirs:
01751                         os.mkdir(newnode)                
01752                     else:
01753                         copy2(node,newnode)
01754                 except IOError, detail:
01755                     print "WARNING: Could not copy %s to %s because %s" % (node,newnode,detail)
01756                 except OSError, detail:
01757                     print "WARNING: Could not copy %s to %s because %s" % (src,dest,detail)                    
01758                 except ReldirExcept:
01759                     print "WARNING: Could not determine new location for source %s into destination %s" % (source,dst)
01760                 else:
01761                     if len(filter) > 0:
01762                         try:
01763                             match = fnmatch.fnmatch(node,filter[0])
01764                             assert not match
01765                         except AssertionError, detail:
01766                             print node, filter[0], match
01767                             raise RuntimeError
01768                     if _verbose:
01769                         if "root" in node:                            
01770                             print "Filter %s Copied %s to %s" % (dontFilter,node,newnode)
01771                             print "fnmatch %s" % fnmatch.fnmatch(node,cpFileFilter[0]) 
01772                     
01773     gen  = os.walk(src)
01774     try:
01775         newloc = _getNewLocation(src,src,dest)
01776 
01777         os.mkdir(newloc)
01778         try:
01779             while True:
01780                 step   = gen.next()
01781                 curdir = step[0]
01782                 dirs   = step[1]
01783                 files  = step[2]
01784 
01785                 _copyFilter(src,dest,curdir,dirs,cpDirFilter,dirs=True)
01786                 _copyFilter(src,dest,curdir,files,cpFileFilter)
01787 
01788         except StopIteration:
01789             pass        
01790     except IOError, detail:
01791         print "WARNING: Could not copy %s to %s because %s" % (src,dest,detail)
01792     except OSError, detail:
01793         print "WARNING: Could not copy %s to %s because %s" % (src,dest,detail)        
01794     except ReldirExcept:
01795         print "WARNING: Could not determine the new location for source %s into destination %s" % (src,dest)
01796         
def syscp(srcs,dest):

def cmsPerfPublish::createCandlHTML (   tmplfile,
  candlHTML,
  CurrentCandle,
  WebArea,
  repdir,
  ExecutionDate,
  LogFiles,
  cmsScimarkResults,
  date,
  prevrev 
)

Definition at line 785 of file cmsPerfPublish.py.

00785                                                                                                                           :
00786     global TimeSizeNumOfEvents,IgProfNumOfEvents,CallgrindNumOfEvents,MemcheckNumOfEvents
00787     def _stripbase(base, astr):
00788         basereg = re.compile("^%s/?(.*)" % base)
00789         out = astr
00790         found = basereg.search(astr)
00791         if found:
00792             out = found.groups()[0]
00793         return out
00794     
00795     def _getProfileReportLink(repdir,CurrentCandle,CurDir,step,CurrentProfile,Profiler):
00796         #FIXME:
00797         #Pileup now has it own directory... should add it in the DirName dictionary at the beginning?
00798         ProfileTemplate=os.path.join(repdir, "%s_%s" % (CurrentCandle,CurDir), "*_%s_%s*" % (step,CurrentProfile),Profiler)
00799         #print ProfileTemplate
00800         #There was the issue of SIM vs sim (same for DIGI) between the previous RelVal based performance suite and the current.
00801         ProfileTemplateLowCaps=os.path.join(repdir, "%s_%s" % (CurrentCandle,CurDir), "*_%s_%s*" % (step.lower(),CurrentProfile),Profiler)        
00802         ProfileReportLink = glob.glob(ProfileTemplate)
00803         #Filter out the Pile up directories when step does not contain Pile up
00804         #if not ('PILEUP' in step):
00805         #    print "NPNPNPNP BEFORE %s"%ProfileReportLink
00806         #    ProfileReportLink=filter(lambda x: "PU" not in x,ProfileReportLink)
00807         #    print "NPNPNPNP %s"%ProfileReportLink
00808         #print ProfileReportLink
00809         if len(ProfileReportLink) > 0:
00810             #print ProfileReportLink
00811             if not reduce(lambda x,y: x or y,map(lambda x: CurrentCandle in x,ProfileReportLink)):# match with caps try low caps
00812                 ProfileReportLink = glob.glob(ProfileTemplateLowCaps)
00813         else:
00814             ProfileReportLink = glob.glob(ProfileTemplateLowCaps)
00815         ProfileReportLink = map(lambda x: _stripbase(repdir,x),ProfileReportLink)
00816         #print ProfileReportLink
00817         return ProfileReportLink
00818 
00819     def _writeReportLink(INDEX,ProfileReportLink,CurrentProfile,step,NumOfEvents,Profiler=""):
00820         if Profiler == "":
00821             INDEX.write("<li><a href=\"%s\">%s %s (%s events)</a></li>\n" % (ProfileReportLink,CurrentProfile,step,NumOfEvents))
00822         else:
00823             if CurrentProfile == "memcheck_valgrind":#FIXME:quick and dirty hack to report we have changed memcheck to 5 events now...
00824                 INDEX.write("<li><a href=\"%s\">%s %s %s (%s events)</a></li>\n" % (ProfileReportLink,CurrentProfile,Profiler,step,"5"))
00825             else:
00826                 INDEX.write("<li><a href=\"%s\">%s %s %s (%s events)</a></li>\n" % (ProfileReportLink,CurrentProfile,Profiler,step,NumOfEvents))
00827     #FIXME:
00828     #These numbers are used in the index.html they are not automatically matched to the actual
00829     #ones (one should automate this, by looking into the cmsCreateSimPerfTestPyRelVal.log logfile)    
00830                             
00831     NumOfEvents={
00832                 DirName[0] : TimeSizeNumOfEvents,
00833                 DirName[1] : IgProfNumOfEvents,
00834                 DirName[2] : CallgrindNumOfEvents,
00835                 DirName[3] : MemcheckNumOfEvents,
00836                 DirName[4] : TimeSizeNumOfEvents,
00837                 DirName[5] : IgProfNumOfEvents,
00838                 DirName[6] : CallgrindNumOfEvents,
00839                 DirName[7] : MemcheckNumOfEvents
00840                 }
00841 
00842     Profile=(
00843         #These need to match the profile directory names ending within the candle directories
00844               "TimingReport",
00845               "TimeReport",
00846               "SimpleMemReport",
00847               "EdmSize",
00848               "IgProfperf",
00849               "IgProfMemTotal",
00850               "IgProfMemLive",
00851               "IgProfMemAnalyse",
00852               "valgrind",
00853               "memcheck_valgrind"
00854                )
00855     IgProfMemAnalyseOut=( #This is the special case of IgProfMemAnalyse
00856                           "doBeginJob_output.html",
00857                           "doEvent_output.html",
00858                           "mem_live.html",
00859                           "mem_total.html" 
00860                           )
00861     memcheck_valgrindOut=( #This is the special case of Valgrind MemCheck (published via Giovanni's script)
00862                            "beginjob.html",
00863                            "edproduce.html",
00864                            "esproduce.html"
00865                            )
00866     OutputHtml={ #These are the filenames to be linked in the candle html page for each profile
00867                  Profile[0] : "*TimingReport.html", #The wildcard spares the need to know the candle name
00868                  Profile[1] : "TimeReport.html", #This is always the same (for all candles)
00869                  Profile[2] : "*.html", #This is supposed to be *SimpleMemoryCheck.html, but there is a bug in cmsRelvalreport.py and it is called TimingReport.html!
00870                  Profile[3] : "objects_pp.html", #This is one of 4 objects_*.html files, it's indifferent which one to pick, just need consistency
00871                  Profile[4] : "overall.html", #This is always the same (for all candles)
00872                  Profile[5] : "overall.html", #This is always the same (for all candles)
00873                  Profile[6] : "overall.html", #This is always the same (for all candles)
00874                  Profile[7] : "doBeginJob_output.html", #This is complicated... there are 3 html to link... (see IgProf MemAnalyse below)
00875                  Profile[8] : "overall.html", #This is always the same (for all candles)
00876                  Profile[9] : "beginjob.html" #This is complicated there are 3 html to link here too... (see Valgrind MemCheck below)
00877                  }
00878 
00879 
00880     candnreg  = re.compile("CandleName")
00881     candhreg  = re.compile("CandlesHere")
00882     try:
00883         CAND = open(candlHTML,"w")
00884         for line in open(tmplfile):
00885             if candhreg.search(line):
00886                 CAND.write('<div id="content">')                
00887                 CAND.write("<h2>")
00888                 CAND.write(CurrentCandle)
00889                 CAND.write("</h2>\n")
00890 
00891                 if _verbose:
00892                     print "Producing candles html: ", CurrentCandle
00893                 
00894                 for CurDir in DirName:
00895 
00896                     LocalPath = os.path.join(repdir,"%s_%s" % (CurrentCandle,CurDir))
00897                     LocalDirname = os.path.basename(LocalPath)
00898 
00899                     if not prevrev == "":
00900 
00901                         profs = []
00902                         if   CurDir == DirName[0] or CurDir == DirName[4]:
00903                             profs = Profile[0:4]
00904                         elif CurDir == DirName[1] or CurDir == DirName[5]:
00905                             profs = Profile[4:8]
00906                         elif CurDir == DirName[2] or CurDir == DirName[6]:
00907                             profs = [Profile[8]] #Keeping format to a list...
00908                         elif CurDir == DirName[3] or CurDir == DirName[7]:
00909                             profs = [Profile[9]] #Keeping format to a list...
00910                         #This could be optimized, but for now just comment the code:
00911                         #This for cycle takes care of the case in which there are regression reports to link to the html:
00912                         for prof in profs:
00913                             if _verbose:
00914                                 print "Scanning for profile information for: ", prof
00915                                 
00916                             printed = False
00917                             fullprof = (CurrentCandle,prof)
00918                             outd     = ""
00919                             nologext = ""                            
00920                             if prof == "TimingReport":
00921                                 timeReports = glob.glob(os.path.join(LocalPath,"%s_*_%s.log" % (CandFname[CurrentCandle],prof)))
00922                                 if len(timeReports) > 0:
00923                                     if not printed:
00924                                         CAND.write("<p><strong>%s %s</strong></p>\n" % (prof,"Regression Analysis"))                                        
00925                                         printed = True
00926                                     for log in timeReports:
00927                                         reportName = os.path.basename(log)
00928                                         (nologext, outd) = getOutputNames(LocalDirname,reportName) 
00929                                         CAND.write("<h4>%s</h4>\n" % reportName)
00930                                         htmNames   = ["changes.gif"]
00931                                         otherNames = ["graphs.gif" , "histos.gif"] 
00932                                         regressHTML= "%s-regress.html" % nologext
00933                                         pathsExist = reduce (lambda x,y: x or y,map(os.path.exists,map(lambda x: os.path.join(repdir,outd,x),otherNames)))
00934                                         html = ""
00935                                         if pathsExist:
00936                                             html = "<p>Performance graphs and histograms superimposed for %s are <a href=\"%s\">here</a></p>\n" % (reportName,regressHTML)
00937                                         else:
00938                                             html = "<p>No change in performance graph available</p>\n"
00939                                         regressHTML="%s/%s" % (WebArea,regressHTML)
00940 
00941                                         for x in htmNames:
00942                                             abspath = os.path.join(repdir,outd,x)
00943                                             if os.path.exists(abspath):
00944                                                 html += "<p><a href=\"./%s/%s\"><img src=\"./%s/%s\" /></a></p>\n" % (outd,x,outd,x)
00945                                             else:
00946                                                 html += "<p>%s does not exist probably because the log file for the previous release was missing</p>" % (abspath)
00947 
00948                                         createRegressHTML(regressHTML,repdir,outd,CurrentCandle,otherNames)
00949                                         CAND.write(html)
00950                                         CAND.write("\n</tr></table>")                                
00951 
00952 
00953                             elif prof == "SimpleMemReport":
00954                                 simMemReports = glob.glob(os.path.join(LocalPath,"%s_*_%s" % (CandFname[CurrentCandle],prof)))
00955                                 simMemReports = map(lambda x: (CandFname[CurrentCandle],prof,x), simMemReports )
00956                                 simMemReports.sort(cmp=dirname_cmp)
00957                                 simMemReports = map(lambda x: x[2], simMemReports )
00958                                 if len(simMemReports) > 0:
00959                                     if not printed:
00960                                         CAND.write("<p><strong>%s %s</strong></p>\n" % (prof,"Regression Analysis"))
00961                                         printed = True                                    
00962                                     for adir in simMemReports:
00963                                         reportName = os.path.basename(adir)
00964                                         CAND.write("<h4>%s</h4>\n" % reportName)
00965                                         htmNames   = ["vsize_change.gif", "rss_change.gif"]
00966                                         otherNames = ["vsize_graphs.gif","rss_graphs.gif"]
00967                                         nologext = reportName
00968                                         outd     = reportName
00969                                         regressHTML= "%s-regress.html" % nologext
00970                                         pathsExist = reduce (lambda x,y: x or y,map(os.path.exists,map(lambda x: os.path.join(repdir,LocalDirname,outd,x),otherNames)))
00971                                         html = ""
00972                                         if pathsExist:
00973                                             html = "<p>Superimposed memory performance graphs for %s are <a href=\"%s\">here</a></p>\n" % (reportName,regressHTML)
00974                                         else:
00975                                             html = "<p>No change in performance graph available</p>\n"
00976                                         regressHTML="%s/%s" % (WebArea,regressHTML)
00977 
00978                                         for x in htmNames:
00979                                             abspath = os.path.join(repdir,LocalDirname,outd,x)
00980                                             if os.path.exists(abspath):
00981                                                 html += "<p><a href=\"./%s/%s/%s\"><img src=\"./%s/%s/%s\" /></a></p>\n" % (LocalDirname,outd,x,LocalDirname,outd,x)
00982                                             else:
00983                                                 html += "<p>%s does not exist probably because the log file for the previous release was missing</p>" % (abspath)
00984 
00985                                         createRegressHTML(regressHTML,repdir,"%s/%s" % (LocalDirname,outd),CurrentCandle,otherNames)
00986                                         CAND.write(html)
00987                                         CAND.write("\n</tr></table>")   
00988 
00989                             elif prof == "EdmSize" or prof == "IgProfMemTotal" or prof == "IgProfMemLive" or prof== "IgProfperf" or prof == "Callgrind":
00990                                 regresPath = os.path.join(LocalPath,"%s_*_%s_regression" % (CandFname[CurrentCandle],prof))
00991                                 regresses  = glob.glob(regresPath)
00992                                 stepreg = re.compile("%s_([^_]*(_PILEUP)?)_%s_regression" % (CandFname[CurrentCandle],prof))
00993                                 if len(regresses) > 0:
00994                                     if not printed:
00995                                         CAND.write("<p><strong>%s %s</strong></p>\n" % (prof,"Regression Analysis"))                                        
00996                                         printed = True
00997                                     regresses = map(lambda x: (CandFname[CurrentCandle],prof,x),regresses)                                        
00998                                     regresses.sort(cmp=reg_dirname_cmp)                                    
00999                                     regresses = map(lambda x: x[2],regresses)
01000                                     for rep in regresses:
01001                                         base  = os.path.basename(rep)
01002                                         found = stepreg.search(base)
01003                                         step = "Unknown-step"
01004                                         if found:
01005                                             step = found.groups()[0]
01006                                         htmlpage = ""
01007                                         if prof == "IgProfMemLive" or prof == "IgProfMemTotal" or prof== "IgProfperf" or prof == "Callgrind":
01008                                             htmlpage = "overall.html"
01009                                         else:
01010                                             htmlpage = "objects_pp.html"
01011                                         CAND.write("<a href=\"%s/%s/%s\">%s %s regression report</a><br/>\n" % (LocalDirname,base,htmlpage,prof,step))
01012                     #Here we go back to the "non-regression" reports listing
01013                     CandleLogFiles = []
01014                     if os.path.exists(LocalPath):
01015                         thedir = os.listdir(LocalPath)
01016                         CandleLogFiles = filter(lambda x: (x.endswith(".log") or x.endswith("EdmSize")) and not os.path.isdir(x) and os.path.exists(x), map(lambda x: os.path.abspath(os.path.join(LocalPath,x)),thedir))                    
01017 
01018                     if (len(CandleLogFiles)>0):
01019                         
01020                         syscp(CandleLogFiles,WebArea + "/")
01021                         base = os.path.basename(LocalPath)
01022                         lfileshtml = ""
01023                      
01024                         for cand in CandleLogFiles:
01025                             cand = os.path.basename(cand)
01026                             if _verbose:
01027                                 print "Found %s in %s\n" % (cand,LocalPath)
01028                                 
01029                             if not "EdmSize" in cand:
01030                                 lfileshtml += "<a href=\"./%s/%s\">%s </a><br/>" % (base,cand,cand)
01031                                     
01032                         CAND.write("<p><strong>Logfiles for %s</strong></p>\n" % CurDir)    
01033                         CAND.write(lfileshtml)
01034 
01035                     PrintedOnce = False
01036                     for CurrentProfile in Profile:
01037                         #print Steps
01038                         for step in Steps: #Using Steps here that is Step+ProductionSteps!
01039                             #print step
01040                             
01041                             ProfileReportLink = _getProfileReportLink(repdir,CurrentCandle,
01042                                                                      CurDir,
01043                                                                      step,
01044                                                                      CurrentProfile,
01045                                                                      OutputHtml[CurrentProfile])
01046                             #if ProfileReportLink:
01047                             #    print ProfileReportLink
01048                             isProfinLink = False
01049                             if len (ProfileReportLink) > 0:
01050                                 isProfinLink = reduce(lambda x,y: x or y,map(lambda x: CurrentProfile in x,ProfileReportLink))
01051 
01052                             if isProfinLink:
01053                                 #It could also not be there
01054 
01055                                 if (PrintedOnce==False): 
01056                                     #Making sure it's printed only once per directory (TimeSize, IgProf, Valgrind) each can have multiple profiles
01057 
01058                                     #This is the "title" of a series of profiles, (TimeSize, IgProf, Valgrind)
01059                                     CAND.write("<p><strong>%s</strong></p>\n" % CurDir)
01060                                     CAND.write("<ul>\n")
01061                                     PrintedOnce=True
01062                                 #Special cases first (IgProf MemAnalyse and Valgrind MemCheck)
01063                                 if (CurrentProfile == Profile[7]):
01064                                     for igprof in IgProfMemAnalyseOut:
01065                                         ProfileReportLink = _getProfileReportLink(repdir,CurrentCandle,
01066                                                                                  CurDir,
01067                                                                                  step,
01068                                                                                  CurrentProfile,
01069                                                                                  igprof)
01070                                         isProfinLink = False
01071                                         if len (ProfileReportLink) > 0:
01072                                             isProfinLink = reduce(lambda x,y: x or y,map(lambda x: CurrentProfile in x,ProfileReportLink))                                        
01073                                         if isProfinLink :#It could also not be there
01074                                             for prolink in ProfileReportLink:
01075                                                 _writeReportLink(CAND,prolink,CurrentProfile,step,NumOfEvents[CurDir],Profiler=igprof)
01076 
01077 
01078                                 elif (CurrentProfile == Profile[9]):
01079 
01080                                     for memprof in memcheck_valgrindOut:
01081                                         #print memprof
01082                                         ProfileReportLink = _getProfileReportLink(repdir,CurrentCandle,
01083                                                                                   CurDir,
01084                                                                                   step,
01085                                                                                   CurrentProfile,
01086                                                                                   memprof
01087                                                                                   )
01088                                         isProfinLink = False
01089                                         if len (ProfileReportLink) > 0:
01090                                             isProfinLink = reduce(lambda x,y: x or y,map(lambda x: CurrentProfile in x,ProfileReportLink))                                        
01091                                         if isProfinLink :#It could also not be there                                        
01092                                             for prolink in ProfileReportLink:
01093                                                 _writeReportLink(CAND,prolink,CurrentProfile,step,NumOfEvents[CurDir],Profiler=memprof)
01094 
01095                                 else:
01096                                     for prolink in ProfileReportLink:
01097                                         if "regression" not in prolink: #To avoid duplication of links to regression reports!
01098                                             _writeReportLink(CAND,prolink,CurrentProfile,step,NumOfEvents[CurDir])
01099                                             #print "Step is %s, CurrentProfile is %s and ProfileReportLink is %s and prolink is %s"%(step,CurrentProfile,ProfileReportLink,prolink)
01100 
01101 
01102                     if PrintedOnce:
01103                         CAND.write("</ul>\n")
01104                     PrintedOnce=False
01105 
01106                 CAND.write("<hr />")
01107                 CAND.write("<br />\n")
01108                 CAND.write("</div>\n")
01109             elif candnreg.search(line):
01110                 CAND.write(CurrentCandle)
01111             else:
01112                 CAND.write(line)
01113 
01114         CAND.close()
01115     except IOError, detail:
01116         print "ERROR: Could not write candle html %s because %s" % (os.path.basename(candlHTML),detail)
01117 
01118 
def populateFromTupleRoot(tupname,repdir,rootfile,pureg):

def cmsPerfPublish::createHTMLtab (   INDEX,
  table_dict,
  ordered_keys,
  header,
  caption,
  name,
  mode = 0 
)

Definition at line 1183 of file cmsPerfPublish.py.

01183                                                                            :
01184     cols     = len(ordered_keys)
01185     totcols  = (cols * 3) + 1
01186     innercol = 3
01187     colspan  = totcols - 1
01188     labels   = []
01189     if mode == 1:
01190         labels = ["fs1","fs2","&#x0394;"]
01191     elif mode == 2 or mode == 3:
01192         colspan = cols
01193         innercol = 1
01194     else:
01195         labels = ["t1" ,"t2" ,"&#x0394;"]
01196 
01197 
01198     INDEX.write("<h3>%s</h3>\n" % header)
01199     INDEX.write("<table>\n")
01200     INDEX.write("<caption>%s</caption>\n" % caption)
01201     INDEX.write("<thead><tr><th></th><th colspan=\"%s\" scope=\"colgroup\">%s</th></tr></thead>" % (colspan,name)) 
01202     INDEX.write("<tbody>\n")
01203     for key in ordered_keys:
01204         INDEX.write("<tr>")
01205         if key == None:
01206             INDEX.write("<th></th>")
01207         else:
01208             INDEX.write("<td scope=\"row\">")
01209             INDEX.write(key)
01210             INDEX.write("</td>")
01211         for col in table_dict[None]:
01212             if key == None:
01213                 INDEX.write("<th colspan=\"%s\" scope=\"col\">" % innercol)
01214                 INDEX.write(col)
01215                 INDEX.write("</th>")                            
01216             else:
01217                 rowdict = table_dict[key].getRowDict()
01218                 if rowdict.has_key(col):
01219                     if mode == 2:
01220                         dat = prettySize(rowdict[col])
01221                         INDEX.write("<td>")
01222                         INDEX.write("%s" % dat)
01223                         INDEX.write("</td>")
01224                         
01225                     elif mode == 3:
01226                         dat = rowdict[col]
01227                         INDEX.write("<td>")
01228                         INDEX.write("%6.2f" % dat)
01229                         INDEX.write("</td>")                        
01230                     else:
01231                         (data1, data2) = rowdict[col]
01232                         diff = data2 - data1
01233 
01234                         if mode == 1:
01235                             diff  = prettySize(diff)
01236                             data1 = prettySize(data1)
01237                             data2 = prettySize(data2)
01238                         
01239                         seq = [ data1, data2, diff ]
01240                         for dat in seq:
01241                             INDEX.write("<td id=\"data\">")
01242                             if mode == 1:
01243                                 INDEX.write("%s" % dat) # %s if                            
01244                             else:
01245                                 INDEX.write("%6.2f" % dat) # %s if                            
01246 
01247                             INDEX.write("</td>")
01248                 else:
01249                     if mode == 2 or mode == 3:
01250                         INDEX.write("<td>")                                    
01251                         INDEX.write("N/A")
01252                         INDEX.write("</td>")                         
01253                     else:
01254                         for i in range(3):
01255                             INDEX.write("<td>")                                    
01256                             INDEX.write("N/A")
01257                             INDEX.write("</td>") 
01258         INDEX.write("</tr>\n")
01259         # write an additional row if this row is the header row
01260         # we need to describe the sub columns
01261         if not (mode == 2 or mode == 3 ):
01262             if key == None:
01263                 INDEX.write("<tr>")
01264                 INDEX.write("<th>Candles</th>")
01265                 for col in table_dict[None]:
01266                     INDEX.write("<th>%s</th>" % labels[0])
01267                     INDEX.write("<th>%s</th>" % labels[1])
01268                     INDEX.write("<th>%s</th>" % labels[2])
01269                 INDEX.write("</tr>\n")
01270     INDEX.write("</tbody></table>\n")
01271 
01272     INDEX.write("<br />")    
01273 
01274 
01275 
#####################

def cmsPerfPublish::createRegressHTML (   reghtml,
  repdir,
  outd,
  CurrentCandle,
  htmNames 
)

Definition at line 622 of file cmsPerfPublish.py.

00622                                                                  :
00623     RegressTmplHTML="%s/doc/regress.html" % (BASE_PERFORMANCE)
00624     candnreg  = re.compile("CandleName")
00625     candhreg  = re.compile("CandlesHere")
00626     try:
00627         REGR = open(reghtml,"w")
00628         for line in open(RegressTmplHTML):
00629             if candhreg.search(line):
00630                 html = "<table>"
00631                 
00632                 for x in htmNames:
00633                     abspath = os.path.join(repdir,outd)
00634                     if os.path.exists(abspath):
00635                         html += "<tr><td><a href=\"./%s/%s\"><img src=\"./%s/%s\" /></a></td></tr>\n" % (outd,x,outd,x)
00636                     else:
00637                         html += "<tr><td> %s does not exist probably because the log file for the previous release was missing</td></tr>" % (abspath)
00638                 html += "</table>"
00639                 REGR.write(html)
00640             elif candnreg.search(line):
00641                 REGR.write(CurrentCandle)
00642             else:
00643                 REGR.write(line)
00644     except IOError, detail:
00645         print "ERROR: Could not write regression html %s because %s" % (os.path.basename(reghtml),detail)                
00646 
def getOutputNames(base,reportName):

def cmsPerfPublish::createWebReports (   WebArea,
  repdir,
  ExecutionDate,
  LogFiles,
  cmsScimarkResults,
  date,
  prevrev 
)

Definition at line 1280 of file cmsPerfPublish.py.

01280                                                                                           :
01281 
01282     #Some nomenclature
01283 
01284     Candle = Candles #These need to match the directory names in the work area
01285 
01286     CmsDriverCandle = CandFname #{ #These need to match the cmsDriver.py output filenames
01287 
01288 
01289     #Produce a "small" index.html file to navigate the html reports/logs etc
01290     IndexFile="%s/index.html" % WebArea
01291     TemplateHtml="%s/doc/index.html" % BASE_PERFORMANCE
01292 
01293     cmsverreg = re.compile("CMSSW_VERSION")
01294     hostreg   = re.compile("HOST")
01295     lpathreg  = re.compile("LocalPath")
01296     fsizereg  = re.compile("FSizeTable")        
01297     cpureg    = re.compile("CPUTable")    
01298     proddreg  = re.compile("ProductionDate")
01299     logfreg   = re.compile("LogfileLinks")
01300     dirbreg   = re.compile("DirectoryBrowsing")
01301     pubdreg   = re.compile("PublicationDate")
01302     candhreg  = re.compile("CandlesHere")
01303     #Loop line by line to build our index.html based on the template one
01304     #Copy the perf_style.css file from Validation/Performance/doc
01305 
01306     CandlTmpltHTML="%s/doc/candle.html" % BASE_PERFORMANCE
01307     if _verbose:
01308         print "Copying %s/doc/perf_style.css style file to %s/." % (BASE_PERFORMANCE,WebArea)    
01309         print "Template used: %s" % TemplateHtml
01310 
01311     syscp((BASE_PERFORMANCE + "/doc/perf_style.css"),WebArea + "/.")
01312     pureg = re.compile("(.*)_PILEUP")    
01313     try:
01314         INDEX = open(IndexFile,"w") 
01315         for NewFileLine in open(TemplateHtml) :
01316             if cmsverreg.search(NewFileLine):
01317                 if prevrev == "":
01318                     INDEX.write("Performance Reports for %s\n" % CMSSW_VERSION)
01319                 else:
01320                     globpath = os.path.join(repdir,"REGRESSION.%s.vs.*" % (prevrev))
01321                     globs = glob.glob(globpath)
01322                     if len(globs) < 1:
01323                         pass
01324                     else:
01325                         latestreg = re.compile("REGRESSION.%s.vs.(.*)" % prevrev)
01326                         found = latestreg.search(os.path.basename(globs[0]))
01327                         if found:
01328                             latestrel = found.groups()[0]
01329                             INDEX.write("Performance Reports with regression: %s VS %s\n" % (prevrev,latestrel))                                                        
01330                         else:
01331                             INDEX.write("Performance Reports with regression: %s VS %s\n" % (prevrev,CMSSW_VERSION))                            
01332             elif hostreg.search(NewFileLine):
01333                 INDEX.write(HOST + "\n")
01334             elif fsizereg.search(NewFileLine):
01335                 if prevrev == "":
01336                     fsize_tab = Table()
01337 
01338                     for cand in Candles:
01339                         fname = CandFname[cand]
01340                         globpath  = os.path.join(repdir,"%s*_TimeSize" % cand,"%s_*.root" % fname)
01341                         rootfiles = glob.glob(globpath)
01342                         rootfiles = map(lambda x: (fname,x), rootfiles)
01343                         rootfiles.sort(cmp=rootfile_cmp)
01344                         rootfiles = map(lambda x: x[1], rootfiles)
01345                         stepreg = re.compile("%s_(.*).root" % fname)
01346                         createNewRow = True
01347                         curRow = None
01348                         createPURow = True
01349                         puRow = None                        
01350                         for rootf in rootfiles:
01351                             base  = os.path.basename(rootf)
01352                             found = stepreg.search(base)
01353                             step  = "Unknown-step"
01354                             if found:
01355                                 step = found.groups()[0]
01356                             realstep  = "Unknown-step"
01357                             if "PILEUP" in step:
01358                                 found = pureg.search(step)
01359                                 if found:
01360                                     realstep = found.groups()[0]
01361                                 if createPURow:
01362                                     createPURow = False
01363                                     puRow = Row(fsize_tab)
01364                             try:
01365                                 statinfo = os.stat(rootf)
01366                                 fsize    = statinfo.st_size
01367                                 if createNewRow:
01368                                     createNewRow = False
01369                                     curRow = fsize_tab.newRow(cand)
01370                                     
01371                                 if "PILEUP" in step:
01372                                     puRow.addEntry(realstep,fsize)
01373                                 else:
01374                                     if createNewRow:
01375                                         createNewRow = False
01376                                         curRow = fsize_tab.newRow(cand)
01377                                         
01378                                     curRow.addEntry(step,fsize)       
01379                             except IOError, detail:
01380                                 print detail
01381                             except OSError, detail:
01382                                 print detail
01383                         if puRow == None:
01384                             pass
01385                         else:
01386                             fsize_tab.addRow(puRow,"%s PILEUP" %cand)                                                                    
01387                     (ordered_keys,table_dict) = fsize_tab.getTable(1)
01388                     cols = len(ordered_keys)
01389                     
01390                     if len(table_dict) > 1 and cols > 0:
01391                         createHTMLtab(INDEX,table_dict,ordered_keys,
01392                                       "Release ROOT file sizes",
01393                                       "Table showing current release ROOT filesizes in (k/M/G) bytes.",
01394                                       "Filesizes",2)   
01395                 else:
01396 
01397                     try:
01398                         globpath = os.path.join(repdir,"REGRESSION.%s.vs.*" % (prevrev))
01399                         globs = glob.glob(globpath)
01400                         if len(globs) < 1:
01401                             raise IOError(2,globpath,"File does not exist","File does not exist")
01402                         idfile  = open(globs[0])
01403                         oldpath = ""
01404                         for line in idfile:
01405                             oldpath = line
01406                         oldpath = oldpath.strip()
01407                         #print "##########TABLE DEBUG :oldpath is %s"%oldpath
01408                         fsize_tab = Table()
01409 
01410                         for cand in Candles:
01411                             fname = CandFname[cand]
01412                             globpath  = os.path.join(repdir,"%s*_TimeSize" % cand,"%s_*.root" % fname)
01413                             rootfiles = glob.glob(globpath)
01414                             rootfiles = map(lambda x: (fname,x), rootfiles)
01415                             rootfiles.sort(cmp=rootfile_cmp)
01416                             rootfiles = map(lambda x: x[1], rootfiles)
01417                             stepreg = re.compile("%s_(.*).root" % fname)
01418                             createNewRow = True
01419                             curRow = None
01420                             createPURow = True
01421                             puRow = None                            
01422                             for rootf in rootfiles:
01423                                 base  = os.path.basename(rootf)
01424                                 found = stepreg.search(base)
01425                                 step  = "Unknown-step"
01426                                 if found:
01427                                     step = found.groups()[0]
01428                                     
01429                                 realstep  = "Unknown-step"
01430                                 if "PILEUP" in step:
01431                                     found = pureg.search(step)
01432                                     if found:
01433                                         realstep = found.groups()[0]
01434                                     if createPURow:
01435                                         createPURow = False
01436                                         puRow = Row(fsize_tab)
01437                                 try:
01438                                     statinfo = os.stat(rootf)
01439                                     fsize2   = statinfo.st_size
01440                                     oldfile  = os.path.join(oldpath,"%s_TimeSize" % cand,base)
01441                                     if "PILEUP" in step:
01442                                         oldfile  = os.path.join(oldpath,"%s_PU_TimeSize" % cand,base)
01443                                     fsize1   = 0
01444 
01445                                     if os.path.exists(oldfile):
01446                                         statinfo = os.stat(oldfile)
01447                                         fsize1   = statinfo.st_size
01448                                     else:
01449                                         print "######DID NOT FIND Previous file (needed for the filesize table): %s"%oldfile
01450                                             
01451                                     if createNewRow:
01452                                         createNewRow = False
01453                                         curRow = fsize_tab.newRow(cand)
01454 
01455                                     data_tuple = (fsize1,fsize2)
01456                                     if "PILEUP" in step:
01457                                         puRow.addEntry(realstep,data_tuple)
01458                                     else:
01459                                         if createNewRow:
01460                                             createNewRow = False
01461                                             curRow = fsize_tab.newRow(cand)
01462 
01463                                         curRow.addEntry(step,data_tuple)
01464                                 except IOError, detail:
01465                                     print detail
01466                                 except OSError, detail:
01467                                     print detail
01468                             if puRow == None:
01469                                 pass
01470                             else:
01471                                 fsize_tab.addRow(puRow,"%s PILEUP" %cand)                                    
01472                                     
01473                         (ordered_keys,table_dict) = fsize_tab.getTable()
01474                         cols = len(ordered_keys)
01475                     
01476                         if len(table_dict) > 1 and cols > 0:
01477                             createHTMLtab(INDEX,table_dict,ordered_keys,
01478                                           "Release ROOT file sizes",
01479                                           "Table showing previous release ROOT filesizes, fs1, latest sizes, fs2, and the difference between them &#x0394; in (k/M/G) bytes.",
01480                                           "Filesizes",1)
01481                     except IOError, detail:
01482                         print detail
01483                     except OSError, detail:
01484                         print detail
01485                 
01486             elif cpureg.search(NewFileLine):
01487                 if prevrev == "":
01488                     time_tab = Table()
01489 
01490                     for cand in Candles:
01491                         fname = CandFname[cand]
01492                         globpath  = os.path.join(repdir,"%s*_TimeSize" % cand,"%s_*_TimingReport.log" % fname)
01493                         logfiles = glob.glob(globpath)
01494                         logfiles = map(lambda x: (fname,x), logfiles)
01495                         logfiles.sort(cmp=logrep_cmp)                        
01496                         logfiles = map(lambda x: x[1], logfiles)
01497 
01498                         stepreg = re.compile("%s_(.*)_TimingReport.log" % fname)
01499                         createNewRow = True
01500                         curRow = None
01501                         createPURow = True
01502                         puRow = None
01503                         for log in logfiles:
01504                             base  = os.path.basename(log)
01505                             found = stepreg.search(base)
01506                             step  = "Unknown-step"
01507                             if found:
01508                                 step = found.groups()[0]
01509 
01510                             realstep  = "Unknown-step"
01511                             if "PILEUP" in step:
01512                                 found = pureg.search(step)
01513                                 if found:
01514                                     realstep = found.groups()[0]
01515                                 if createPURow:
01516                                     createPURow = False
01517                                     puRow = Row(time_tab)
01518                                 
01519                             data = cpr.getTimingLogData(log)
01520                             mean = 0
01521                             i    = 0
01522                             for evtnum, time in data:
01523                                 mean += time
01524                                 i += 1
01525                             try:
01526                                 mean = mean / float(i)
01527                             except ZeroDivisionError, detail:
01528                                 print "WARNING: Could not calculate mean CPU time from log because no events could be parsed", log
01529 
01530                             if "PILEUP" in step:
01531                                 puRow.addEntry(realstep,mean)
01532                             else:
01533                                 if createNewRow:
01534                                     createNewRow = False
01535                                     curRow = time_tab.newRow(cand)
01536 
01537                                 curRow.addEntry(step,mean)                                
01538                         if puRow == None:
01539                             pass
01540                         else:
01541                             time_tab.addRow(puRow,"%s PILEUP" %cand)
01542 
01543                     (ordered_keys,table_dict) = time_tab.getTable(1)
01544                     cols = len(ordered_keys)
01545                     
01546                     if len(table_dict) > 1 and cols > 0:
01547                         createHTMLtab(INDEX,table_dict,ordered_keys,
01548                                       "Release CPU times",
01549                                       "Table showing current release CPU times in secs.",
01550                                       "CPU Times (s)",3)                        
01551                 else:
01552 
01553 
01554                     ####
01555                     #
01556                     # Create the table data structure
01557                     #
01558                     cpu_time_tab =  populateFromTupleRoot("cpu_time_tuple",repdir,"timing-regress.root",pureg)
01559                     
01560 
01561                     ###########
01562                     #
01563                     # Create HTML table from table data structure
01564                     #
01565 
01566                     (ordered_keys,table_dict) = cpu_time_tab.getTable()
01567 
01568                     cols = len(ordered_keys)
01569                     if len(table_dict) > 1 and cols > 0:
01570                         createHTMLtab(INDEX,table_dict,ordered_keys,
01571                                       "Release CPU times",
01572                                       "Table showing previous release CPU times, t1, latest times, t2, and the difference between them &#x0394; in secs.",
01573                                       "CPU Times (s)")
01574 
01575                         
01576                     
01577             elif lpathreg.search(NewFileLine):
01578                 INDEX.write(repdir + "\n")
01579             elif proddreg.search(NewFileLine):
01580                 INDEX.write(ExecutionDate + "\n")
01581             elif logfreg.search(NewFileLine):
01582                 INDEX.write("<br />\n")
01583                 for log in LogFiles:
01584                     log = os.path.basename(log)
01585                     if _verbose:
01586                         print "linking log file %s" % log
01587                     INDEX.write("<a href=\"./%s\"> %s </a>" % (log,log))
01588                     INDEX.write("<br />\n")
01589                 #Add the cmsScimark results here:
01590                 INDEX.write("Results for cmsScimark2 benchmark (running on the other cores) available at:\n")
01591                 for cmssci in cmsScimarkResults:
01592                     scimarkdirs=cmssci.split("/")
01593                     localdir=scimarkdirs[-2]
01594                     #print localdir
01595                     cmssci = os.path.basename(cmssci)
01596                     relativelink=os.path.join(localdir,cmssci)
01597                     #print relativelink
01598                     INDEX.write("<a href=\"%s\"> %s </a>" % (relativelink,cmssci))
01599                     INDEX.write("<br />\n")
01600 
01601 
01602             elif dirbreg.search(NewFileLine):
01603                 #Create a subdirectory DirectoryBrowsing to circumvent the fact the dir is not browsable if there is an index.html in it.
01604                 #Bug! This does not work since it points to index.html automatically!
01605                 #os.symlink("./","%s/DirectoryBrowsing" % WebArea)
01606                 #Actually all the following is done later...
01607                 #Create a physical directory first
01608                 #os.mkdir("%s/DirectoryBrowsing" % WebArea)
01609                 #Then will populate it with symbolic links(once they have been copied there!) from all WebArea files, except index.html, see down towards the end!
01610                 INDEX.write("Click <a href=\"./DirectoryBrowsing/\">here</a> to browse the directory containing all results (except the root files)\n")
01611 
01612             elif pubdreg.search(NewFileLine):
01613                 INDEX.write(date + "\n")
01614             elif candhreg.search(NewFileLine):
01615                 for acandle in Candle:
01616                     globpath = os.path.join(repdir,"%s_*" % acandle)
01617                     globs = glob.glob(globpath)
01618                     if len(globs) > 0:
01619                         candlHTML = "%s.html" % acandle
01620                         INDEX.write("<a href=\"./%s\"> %s </a>" % (candlHTML,acandle))
01621                         INDEX.write("<br />\n")
01622                     
01623                         candlHTML=os.path.join(WebArea,candlHTML)
01624                         createCandlHTML(CandlTmpltHTML,candlHTML,acandle,WebArea,repdir,ExecutionDate,LogFiles,cmsScimarkResults,date,prevrev)
01625             else:
01626                 INDEX.write(NewFileLine)
01627 
01628         #End of while loop on template html file
01629         INDEX.close()
01630     except IOError, detail:
01631         print "Error: Could not create index Html file for some reason, check position. Details : %s" % detail
01632 
########################

def cmsPerfPublish::delTmpDir (  ) 

Definition at line 1675 of file cmsPerfPublish.py.

01675                :
01676     if os.path.exists(TMP_DIR) and IS_TMP:
01677         os.system("rm -Rf " + TMP_DIR)
01678 
#####################

def cmsPerfPublish::dirname_cmp (   x,
  y 
)

Definition at line 667 of file cmsPerfPublish.py.

00667                     :
00668     (candle,prof,x) = x
00669     (candle,prof,y) = y
00670     x = os.path.basename(x)
00671     y = os.path.basename(y)
00672     stepreg = re.compile("%s_(..*)_%s" % (candle,prof))
00673     if stepreg.search(x):
00674         x = stepreg.search(x).groups()[0]
00675     if stepreg.search(y):
00676         y = stepreg.search(y).groups()[0]
00677     return step_cmp(x,y)
00678 
def reg_dirname_cmp(x,y):

def cmsPerfPublish::docopy (   src,
  dest 
)

Definition at line 1725 of file cmsPerfPublish.py.

01725                     :
01726     try:
01727         copy2(src,dest)
01728     except OSError, detail:
01729         print "WARNING: Could not copy %s to %s because %s" % (src,dest,detail)        
01730     except IOError, detail:
01731         print "WARNING: Could not copy %s to %s because %s" % (src,dest,detail)
01732     else:
01733         if _verbose:
01734             print "Copied %s to %s" % (src,dest)
01735 
def copytree4(src,dest,keepTop=True):

def cmsPerfPublish::fail (   errstr = ""  ) 

Definition at line 58 of file cmsPerfPublish.py.

Referenced by CalibrationTask::checkAndSave(), CalibrationScanTask::checkAndSave(), HLTLevel1GTSeed::convertStringToBitNumber(), EgHLTOfflineClient::createLooseTightTrigEff(), EcalUncalibRecHitFixedAlphaBetaAlgo< C >::PerformAnalyticFit(), ContentsYRange::runTest(), ContentsXRange::runTest(), ContentsWithinExpected::runTest(), DeadChannel::runTest(), NoisyChannel::runTest(), SimpleCosmicBONSeeder::seeds(), stringToNumber(), cscdqm::stringToNumber(), L1GtTriggerMenuXmlParser::workAlgorithm(), and L1GtTriggerMenuXmlParser::workTechTrigger().

00058                    :
00059     print errstr
00060     delTmpDir()
00061     sys.exit()
00062 
def addtrailingslash(adir):

def cmsPerfPublish::get_environ (  ) 

Definition at line 272 of file cmsPerfPublish.py.

00272                  :
00273     global CMSSW_VERSION, CMSSW_RELEASE_BASE, CMSSW_BASE, HOST, USER, BASE_PERFORMANCE, CMSSW_WORK
00274     global DEF_RELVAL, DEF_SIMUL
00275     
00276     try:
00277         CMSSW_VERSION=os.environ['CMSSW_VERSION']
00278         CMSSW_RELEASE_BASE=os.environ['CMSSW_RELEASE_BASE']
00279         CMSSW_BASE=os.environ['CMSSW_BASE']
00280         HOST=os.environ['HOST']
00281         USER=os.environ['USER']
00282         CMSSW_WORK = os.path.join(CMSSW_BASE,"work/Results")
00283     except KeyError, detail:
00284         fail("ERROR: Could not retrieve some necessary environment variables. Have you ran scramv1 runtime -csh yet?. Details: %s" % detail)
00285 
00286     LocalPath=getcmdBasic("pwd")
00287     ShowTagsResult=getcmdBasic("showtags -r")
00288 
00289     #Adding a check for a local version of the packages
00290     PerformancePkg="%s/src/Validation/Performance"        % CMSSW_BASE
00291     if (os.path.exists(PerformancePkg)):
00292         BASE_PERFORMANCE=PerformancePkg
00293         print "**Using LOCAL version of Validation/Performance instead of the RELEASE version**"
00294     else:
00295         BASE_PERFORMANCE="%s/src/Validation/Performance"  % CMSSW_RELEASE_BASE
00296 
00297     return (LocalPath,ShowTagsResult)
00298 
###############

def cmsPerfPublish::getcmd (   command  ) 

Definition at line 75 of file cmsPerfPublish.py.

00075                    :
00076     if _debug > 2:
00077         print command
00078     return os.popen4(command)[1].read().strip()
00079 
def prettySize(size):

def cmsPerfPublish::getcmdBasic (   cmd  ) 

Definition at line 72 of file cmsPerfPublish.py.

00072                     :
00073     return os.popen4(cmd)[1].read().strip()
00074 
def getcmd(command):

def cmsPerfPublish::getDate (  ) 

Definition at line 69 of file cmsPerfPublish.py.

00069              :
00070     return time.ctime()
00071 
def getcmdBasic(cmd):

def cmsPerfPublish::getDirnameDirs (   repdir,
  WebArea 
)

Definition at line 1637 of file cmsPerfPublish.py.

01637                                   :
01638     Dir = os.listdir(repdir)
01639     def _containsDirName(elem):
01640         return reduce(lambda x,y: x or y,map(lambda x: x in elem, DirName))
01641     def _print4Lambda(elem,WebArea):
01642         if _verbose:
01643             print "Copying %s to %s\n" %  (elem,WebArea)
01644 
01645     dirstocp = filter(lambda x: _containsDirName(x),map(lambda x: repdir + x,Dir))
01646     map(lambda x: _print4Lambda(x,WebArea),dirstocp)
01647     syscp(dirstocp,WebArea + "/")
01648     os.mkdir("%s/DirectoryBrowsing" % WebArea)
01649     for file in os.listdir(WebArea):
01650         if file != "index.html": #Potential maintenance issue if the index.html changes name to something the server automatically displays when pointing to the directory...
01651             #Use relative path ".." instead of WebArea to avoid problems when copying stuff to a remote server!
01652             os.symlink("%s/%s"%("..",file),"%s/DirectoryBrowsing/%s" % (WebArea,file))
01653 
#######################

def cmsPerfPublish::getNumOfEventsFromLog (   logfile  ) 

A very fragile function to get the Number of events for each test by parsing the logfile of the Suite. This relies on the fact that nobody will turn off the print out of the options in the cmsPerfSuite.py output... ARGH!

Definition at line 412 of file cmsPerfPublish.py.

00412                                   :
00413     '''A very fragile function to get the Number of events for each test by parsing the logfile of the Suite. This relies on the fact that nobody will turn off the print out of the options in the cmsPerfSuite.py output... ARGH!'''
00414     log=open(logfile,"r")
00415     TimeSizeEvents=0
00416     IgProfEvents=0
00417     CallgrindEvents=0
00418     MemcheckEvents=0
00419     for line in log:
00420         if 'TimeSizeEvents' in line and not TimeSizeEvents:
00421             lineitems=line.split()
00422             TimeSizeEvents=lineitems[lineitems.index('TimeSizeEvents')+1]
00423         if 'IgProfEvents' in line and not IgProfEvents:
00424             lineitems=line.split()
00425             IgProfEvents=lineitems[lineitems.index('IgProfEvents')+1]
00426         if 'CallgrindEvents' in line and not CallgrindEvents:
00427             lineitems=line.split()
00428             CallgrindEvents=lineitems[lineitems.index('CallgrindEvents')+1]
00429         if 'MemcheckEvents' in line and not MemcheckEvents:
00430             lineitems=line.split()
00431             MemcheckEvents=lineitems[lineitems.index('MemcheckEvents')+1]
00432     return (TimeSizeEvents,IgProfEvents,CallgrindEvents,MemcheckEvents)
00433 
00434 
#####################

def cmsPerfPublish::getOutputNames (   base,
  reportName 
)

Definition at line 647 of file cmsPerfPublish.py.

00647                                    :
00648     logreg   = re.compile("(.*)\.log$")
00649     matches  = logreg.search(reportName)
00650     logdir   = logreg.sub(matches.groups()[0],reportName)
00651     outd     = os.path.join(base,logdir)
00652     nologext = matches.groups()[0]
00653     return (nologext,outd)
00654 
def rootfile_cmp(x,y):

def cmsPerfPublish::getRelativeDir (   parent,
  child,
  keepTop = True 
)

Definition at line 1683 of file cmsPerfPublish.py.

01683                                              :
01684     def _walkpath(path):
01685         dirs = []
01686         while True:
01687             head , tail = os.path.split(path)
01688             if tail == "":
01689                 break
01690             dirs.append(tail)
01691             path = head
01692         for i in range(len(dirs)-1,-1,-1):
01693             adir = dirs[i]
01694             yield adir
01695         return
01696     pwalk = _walkpath(parent)
01697     n = 0
01698     try:
01699         while True:
01700             pwalk.next()
01701             n += 1
01702     except StopIteration:
01703         pass
01704 
01705     if keepTop:
01706         n = n - 1
01707 
01708     cwalk = _walkpath(child)
01709     try:
01710         #prewalk
01711         for x in range(n):
01712             cwalk.next()
01713     except StopIteration:
01714         print "ERROR: Unable to determine relative dir"
01715         raise ReldirExcept
01716 
01717     relpath = ""
01718     try:
01719         while True:
01720             relpath=os.path.join(relpath,cwalk.next())
01721     except StopIteration:
01722         pass
01723     return relpath
01724 
def docopy(src,dest):

def cmsPerfPublish::getStageRepDirs (   options,
  args 
)

Definition at line 439 of file cmsPerfPublish.py.

00439                                  :
00440     global TMP_DIR, IS_TMP, DEF_LOCAL, CMSSW_VERSION
00441     DEF_LOCAL = CMSSW_WORK
00442     numofargs = len(args)
00443 
00444     repdir = os.path.abspath(options.repdir)
00445     repdir = addtrailingslash(repdir)
00446 
00447     if not os.path.exists(repdir):
00448         fail("ERROR: The specified report directory %s to retrieve report information from does not exist, exiting" % repdir)
00449 
00450     previousrev = options.previousrev
00451     if previousrev == "":
00452         regressfiles = glob.glob("%s/REGRESSION.*.vs.*" % repdir)
00453         if not len(regressfiles) == 0:
00454             regressID   = regressfiles[0]
00455             base        = os.path.basename(regressID)
00456             split       = base.split(".")
00457             previousrev = split[1]
00458             currentrel  = split[3]
00459             print "Regression Identification file exists, renaming report title for regression report. Old ver: %s" % previousrev
00460         else:
00461             print "No regression ID file exists and previous release name was not specified. Producing normal report."
00462     else:
00463         print "Previous release name was specified, renaming report title for regression report. Old ver %s" % previousrev
00464     
00465     uri = ""
00466     defaultlocal = False
00467     if options.simulation:
00468         uri = DEF_SIMUL
00469     elif options.relval:
00470         uri = DEF_RELVAL
00471     elif numofargs >= 1:
00472         uri = args[0] # Add directory CMSSW_VERSION later in temp! Not now, otherwise we get into a mess if this is a remote dir
00473     else:
00474         defaultlocal = True
00475         uri = DEF_LOCAL
00476 
00477     ####
00478     #
00479     # Determine if location is remote
00480     #
00481     # Try not to re-arrange we don't want to assume that default locations are not remote
00482     #
00483     ####
00484 
00485     drive = ""
00486     path = ""
00487     if ":" in uri:
00488         drive, path = uri.split(":",1)
00489     else:
00490         path = uri
00491         
00492     if drive == "":
00493         path = os.path.abspath(path)
00494     remote = not drive == ""
00495 
00496     if remote:
00497         unResolved = True
00498         try:
00499             socket.getaddrinfo(drive,53)
00500             unResolved = False
00501         except socket.gaierror:
00502             unResolved = True
00503 
00504         # try see if it's an ipaddress
00505         if unResolved:
00506             try:
00507                 socket.gethostbyaddr(drive)
00508                 unResolved = False
00509             except socket.gaierror:
00510                 unResolved = True
00511             if unResolved:
00512                 print "ERROR: Can not determine your hostname or ipv{4,6} address %s" % drive
00513                 if not (_dryrun or _test):
00514                     fail("exiting...")
00515 
00516     if (not remote) and (not options.port == 873) :
00517         print "WARNING: Can not use a port if not performing a remote copy, ignoring"
00518     port = options.port
00519 
00520     ###
00521     #
00522     # Determine Staging Area
00523     #
00524 
00525     StagingArea=""
00526     localExists = os.path.exists("%s/%s" % (CMSSW_WORK,CMSSW_VERSION))
00527     
00528     if remote:
00529         #Cannot use this since the /tmp is limited to 2GB on lxbuild machines!
00530         #TMP_DIR=tmp.mkdtemp(prefix="/tmp/%s" % PROG_NAME)
00531         TMP_DIR=tmp.mkdtemp(prefix="/build/%s" % PROG_NAME)
00532         StagingArea = TMP_DIR
00533     #Local but dir already exists
00534     elif defaultlocal and localExists:
00535         TMP_DIR=tmp.mkdtemp(prefix="%s/%s" % (CMSSW_WORK,CMSSW_VERSION))
00536         StagingArea = TMP_DIR
00537         print "WARNING: %s already exists, creating a temporary staging area %s" % (CMSSW_WORK,TMP_DIR)
00538     #Local cases
00539     elif defaultlocal:
00540         StagingArea = CMSSW_WORK
00541         try:
00542             os.mkdir(os.path.join(CMSSW_BASE,"work"))
00543             os.mkdir(os.path.join(CMSSW_BASE,"work","Results"))
00544         except OSError:
00545             pass
00546         print "**User did not specify location of results, staging in default %s**" % StagingArea 
00547     else:
00548         print "**User chose to publish results in a local directory**" 
00549         StagingArea = path
00550         if not os.path.exists(path):
00551             try:
00552                 os.mkdir("%s" % path)
00553             except OSError, detail:
00554                 if   detail.errno == 13:
00555                     fail("ERROR: Failed to create staging area %s because permission was denied " % StagingArea)
00556                 elif detail.errno == 17:
00557                     #If the directory already exists just carry on
00558                     pass
00559                 else:
00560                     fail("ERROR: There was some problem (%s) when creating the staging directory" % detail)            
00561 
00562     IS_TMP = not TMP_DIR == ""
00563     ######
00564     #
00565     # create Version dir
00566     # This is why when we create a Tmp dir we get the version(tmpname)/version
00567     # structure. We should remove this if we don't want it but i dont think it matters
00568     StagingArea="%s/%s" % (StagingArea,CMSSW_VERSION)
00569     try:
00570         os.mkdir("%s" % StagingArea)
00571     except OSError, detail:
00572         if   detail.errno == 13:
00573             fail("ERROR: Failed to create staging area %s because permission was denied " % StagingArea)
00574         elif detail.errno == 17:
00575             #If the directory already exists just carry on
00576             pass
00577         else:
00578             fail("ERROR: There was some problem (%s) when creating the staging directory" % detail)
00579 
00580     return (drive,path,remote,StagingArea,port,repdir,previousrev)
00581 
####################

def cmsPerfPublish::logrep_cmp (   x,
  y 
)

Definition at line 691 of file cmsPerfPublish.py.

00691                    :
00692     (fname,x) = x
00693     (fname,y) = y    
00694     x = os.path.basename(x)
00695     y = os.path.basename(y)
00696     stepreg = re.compile("%s_(..*)_TimingReport.log" % fname)
00697     if stepreg.search(x):
00698         x = stepreg.search(x).groups()[0]
00699     if stepreg.search(y):
00700         y = stepreg.search(y).groups()[0]
00701     return step_cmp(x,y)
00702 
def timerep_cmp(x,y):

def cmsPerfPublish::main (  ) 

Definition at line 192 of file cmsPerfPublish.py.

00192           :
00193     global TimeSizeNumOfEvents,IgProfNumOfEvents,CallgrindNumOfEvents,MemcheckNumOfEvents
00194     def _copyReportsToStaging(repdir,LogFiles,cmsScimarkDir,stage):
00195 
00196         if _verbose:
00197             print "Copying the logfiles to %s/." % stage
00198             print "Copying the cmsScimark2 results to the %s/." % stage  
00199 
00200         syscp(LogFiles     , stage + "/")
00201         syscp(cmsScimarkDir, stage + "/")
00202 
00203     def _createLogFile(LogFile,date,LocalPath,ShowTagsResult):
00204         try:
00205             LOG = open(LogFile,"w")
00206             if _verbose:
00207                 print "Writing Production Host, Location, Release and Tags information in %s" % LogFile 
00208             LOG.write("These performance tests were executed on host %s and published on %s" % (HOST,date))
00209             LOG.write("They were run in %s" % LocalPath)
00210             LOG.write("Results of showtags -r in the local release:\n%s" % ShowTagsResult)
00211             LOG.close()
00212         except IOError, detail:
00213             print "WARNING: Can't create log file"            
00214             print detail
00215 
00216     # Print Program header
00217     print_header()
00218 
00219     # Get environment variables
00220     print "\n Getting Environment variables..."
00221     (LocalPath, ShowTagsResult) = get_environ()
00222 
00223     # Parse options
00224     (options,args) = optionparse()
00225 
00226     # Determine program parameters and input/staging locations
00227     print "\n Determining locations for input and staging..."
00228     (drive,path,remote,stage,port,repdir,prevrev) = getStageRepDirs(options,args)
00229 
00230     #Get the number of events for each test from logfile:
00231     print "\n Getting the number of events for each test..."
00232     #Let's do a quick implementation of something that looks at the logfile:
00233     cmsPerfSuiteLogfile="%s/cmsPerfSuite.log"%repdir
00234     #print "AAAA %s"%cmsPerfSuiteLogfile
00235     if os.path.exists(cmsPerfSuiteLogfile):
00236         (TimeSizeNumOfEvents,IgProfNumOfEvents,CallgrindNumOfEvents,MemcheckNumOfEvents)=getNumOfEventsFromLog(cmsPerfSuiteLogfile)
00237     #For now keep the dangerous default? Better set it to a negative number...
00238 
00239     print "\n Scan report directory..."
00240     # Retrieve some directories and information about them
00241     (ExecutionDate,LogFiles,date,cmsScimarkResults,cmsScimarkDir) = scanReportArea(repdir)
00242     print "cmsScimarkResults are %s"%cmsScimarkResults
00243     print "\n Copy report files to staging directory..."
00244     # Copy reports to staging area 
00245     _copyReportsToStaging(repdir,LogFiles,cmsScimarkDir,stage)
00246 
00247     print "\n Creating log file..."
00248     # Produce a small logfile with basic info on the Production area
00249     _createLogFile("%s/ProductionLog.txt" % stage,date,repdir,ShowTagsResult)
00250 
00251     print "\n Creating HTML files..."
00252     # create HTML files
00253     createWebReports(stage,repdir,ExecutionDate,LogFiles,cmsScimarkResults,date,prevrev)
00254 
00255     print "\n Copy profiling logs to staging directory..."
00256     # Copy over profiling logs...
00257     getDirnameDirs(repdir,stage)
00258 
00259     # Send files to remote location
00260     if remote:
00261         print "\n Uploading web report to remote location..."
00262         syncToRemoteLoc(stage,drive,path,port)
00263         print "\n Finished uploading! Now removing staging directory..."
00264         delTmpDir()
00265 
00266     print "\n Finished!!!"
00267 
##########################

def cmsPerfPublish::optionparse (  ) 

Definition at line 302 of file cmsPerfPublish.py.

00302                  :
00303     global PROG_NAME, _debug, _dryrun, _verbose
00304 
00305     parser = opt.OptionParser(usage=("""%s [HOST:]DEST_PATH [Options]
00306 
00307     Arguments:
00308         [HOST:]DEST_PATH - This is where the report should be published, you can specify a local path or a directory on a remote machine (HOST is optional)
00309 
00310     Examples:  
00311        Publish report to default local directory
00312         ./%s 
00313        Publish report to \"/some/local/dir\"
00314         ./%s /some/local/dir
00315        Publish report to \"/some/other/dir\" remote host \"hal.cern.ch\" 
00316         ./%s hal.cern.ch:/some/other/dir
00317        Publish report to default relval location (this could be remote or local depending on the hardcoded default)
00318         ./%s --relval"""
00319       % ( PROG_NAME, PROG_NAME, PROG_NAME, PROG_NAME, PROG_NAME)))
00320     
00321     devel  = opt.OptionGroup(parser, "Developer Options",
00322                                      "Caution: use these options at your own risk."
00323                                      "It is believed that some of them bite.\n")
00324     parser.add_option(
00325         '--relval',
00326         action="store_true",
00327         dest='relval',
00328         help='Use the default RelVal location',
00329         #metavar='<STEPS>',
00330         )
00331 
00332     parser.add_option(
00333         '-v',
00334         '--verbose',
00335         action="store_true",
00336         dest='verbose',
00337         help='output more information',
00338         #metavar='<STEPS>',
00339         )    
00340 
00341     parser.add_option(
00342         '--simul',
00343         action="store_true",
00344         dest='simulation',
00345         help='Use the default simulation location',
00346         #metavar='<STEPS>',
00347         )
00348 
00349     parser.add_option(
00350         '--prev',
00351         type="string",
00352         dest='previousrev',
00353         help='The override the name of the previous release. Default is the string obtain from the identification file REGRESSION.<prevrel>.vs.<newrel>',
00354         metavar='<NAME>',
00355         default="",
00356         )    
00357 
00358     parser.add_option(
00359         '--input',
00360         type="string",
00361         dest='repdir',
00362         help='The location of the report files to be published',
00363         metavar='<DIR>'
00364         )
00365 
00366     parser.add_option(
00367         '-p',
00368         '--port',
00369         type='int',
00370         dest='port',
00371         help='Use a particular port number to rsync material to a remote server',
00372         metavar='<PORT>'
00373         )
00374 
00375     devel.add_option(
00376         '-d',
00377         '--debug',
00378         type='int',
00379         dest='debug',
00380         help='Show debug output',
00381         #metavar='DEBUG',
00382         )
00383 
00384     devel.add_option(
00385         '--dry-run',
00386         action="store_true",
00387         dest='dryrun',
00388         help='Do not send files to remote server, but run everything else',
00389         #metavar='DEBUG',
00390         )
00391 
00392     repdirdef = os.getcwd()
00393     parser.set_defaults(debug=0,simulation=False,relval=False,port=873,pretend=False,repdir=repdirdef,verbose=False)
00394     parser.add_option_group(devel)
00395 
00396     (options, args) = parser.parse_args()
00397 
00398     _debug   = options.debug
00399     _dryrun  = options.dryrun
00400     _verbose = options.verbose
00401 
00402     numofargs = len(args) 
00403 
00404     if (options.simulation and options.relval) or ((options.simulation or options.relval) and numofargs >= 1):
00405         parser.error("You can not specify simulation and relval together. Neither can you specify simulation or relval AND a path")
00406         sys.exit()
00407 
00408     return (options, args)
00409 
00410 
00411 #A function to get the number of events for each test from the logfile:
def getNumOfEventsFromLog(logfile):

def cmsPerfPublish::populateFromTupleRoot (   tupname,
  repdir,
  rootfile,
  pureg 
)

Definition at line 1119 of file cmsPerfPublish.py.

01119                                                         :
01120     table = Table()
01121     for cand in Candles:
01122         fname = CandFname[cand]
01123         globpath = os.path.join(repdir,"%s_TimeSize" % cand,"%s_*_TimingReport" % fname)
01124         stepDirs = glob.glob(globpath)
01125         stepDirs = map(lambda x: (fname,x), stepDirs)
01126         stepDirs.sort(cmp=timerep_cmp)
01127         stepDirs = map(lambda x: x[1], stepDirs)
01128         stepreg = re.compile("%s_(.*)_TimingReport" % fname)
01129         createNewRow = True
01130         curRow = None
01131         createPURow = True
01132         puRow = None
01133         for stepdir in stepDirs:
01134             base  = os.path.basename(stepdir)
01135             found = stepreg.search(base)
01136             step  = "Unknown-step"
01137             if found:
01138                 step = found.groups()[0]
01139             realstep  = "Unknown-step"
01140             if "PILEUP" in step:
01141                 found = pureg.search(step)
01142                 if found:
01143                     realstep = found.groups()[0]
01144                 if createPURow:
01145                     createPURow = False
01146                     puRow = Row(table)                
01147             rootf = os.path.join(stepdir,rootfile)
01148 
01149             if os.path.exists(rootf):
01150                 f = ROOT.TFile(rootf)
01151 
01152                 cpu_time_tree = ROOT.TTree()
01153                 f.GetObject("cpu_time_tuple;1",cpu_time_tree)
01154                 if cpu_time_tree:
01155                     if cpu_time_tree.InheritsFrom("TTree"):
01156                         data1 = None
01157                         data2 = None
01158                         for t in cpu_time_tree:
01159                             data1 = t.total1
01160                             data2 = t.total2
01161                         if data1 and data2:
01162                             if createNewRow:
01163                                 createNewRow = False
01164                                 curRow = table.newRow(cand)
01165                             data_tuple = (data1,data2)
01166 
01167                             if "PILEUP" in step:
01168                                 puRow.addEntry(realstep,data_tuple)
01169                             else:
01170                                 if createNewRow:
01171                                     createNewRow = False
01172                                     curRow = table.newRow(cand)
01173 
01174                                 curRow.addEntry(step,data_tuple)
01175                 f.Close()
01176         if puRow == None:
01177             pass
01178         else:
01179             table.addRow(puRow,"%s PILEUP" %cand)                
01180     return table
01181                 
01182 
def createHTMLtab(INDEX,table_dict,ordered_keys,header,caption,name,mode=0):

def cmsPerfPublish::prettySize (   size  ) 

Definition at line 80 of file cmsPerfPublish.py.

00080                     :
00081     nega = size < 0
00082     if nega:
00083         size = -size
00084     suffixes = [("B",2**10), ("k",2**20), ("M",2**30), ("G",2**40), ("T",2**50)]
00085     for suf, lim in suffixes:
00086         if size > lim:
00087             continue
00088         else:
00089             if nega:
00090                 return "-" + round(size/float(lim/2**10),2).__str__() + suf
00091             else:
00092                 return round(size/float(lim/2**10),2).__str__()+suf                
00093 
class Row(object):

def cmsPerfPublish::print_header (  ) 

Definition at line 1817 of file cmsPerfPublish.py.

01817                   :
01818     print "%s\n" % PROG_NAME
01819 
if __name__ == "__main__":

def cmsPerfPublish::reg_dirname_cmp (   x,
  y 
)

Definition at line 679 of file cmsPerfPublish.py.

00679                         :
00680     (candle,prof,x) = x
00681     (candle,prof,y) = y
00682     x = os.path.basename(x)
00683     y = os.path.basename(y)
00684     stepreg = re.compile("%s_(..*)_%s_regression" % (candle,prof))
00685     if stepreg.search(x):
00686         x = stepreg.search(x).groups()[0]
00687     if stepreg.search(y):
00688         y = stepreg.search(y).groups()[0]
00689     return step_cmp(x,y)
00690 
def logrep_cmp(x,y):

def cmsPerfPublish::rootfile_cmp (   x,
  y 
)

Definition at line 655 of file cmsPerfPublish.py.

00655                      :
00656     (fname,x) = x
00657     (fname,y) = y
00658     x = os.path.basename(x)
00659     y = os.path.basename(y)
00660     stepreg = re.compile("%s_(..*)\.root" % fname)
00661     if stepreg.search(x):
00662         x = stepreg.search(x).groups()[0]
00663     if stepreg.search(y):
00664         y = stepreg.search(y).groups()[0]
00665     return step_cmp(x,y)
00666 
def dirname_cmp(x,y):

def cmsPerfPublish::scanReportArea (   repdir  ) 

Definition at line 586 of file cmsPerfPublish.py.

00586                           :
00587     date=getDate()
00588     LogFiles  = glob.glob(repdir + "cms*.log")
00589     if _verbose:
00590         print "Found the following log files:"
00591         print LogFiles
00592 
00593     cmsScimarkDir = glob.glob(repdir + "cmsScimarkResults_*")
00594     if _verbose:
00595         print "Found the following cmsScimark2 results directories:"
00596         print cmsScimarkDir
00597 
00598     cmsScimarkResults = []
00599     for adir in cmsScimarkDir:
00600         htmlfiles = glob.glob(adir + "/*.html") 
00601         map(cmsScimarkResults.append,htmlfiles)
00602 
00603     ExecutionDateLast = ""
00604     ExecutionDate = ""
00605     ExecutionDateSec=0
00606     cmsreg = re.compile("^cmsPerfSuite")
00607     for logf in LogFiles:
00608         if cmsreg.search(logf):
00609             ExecutionDateLastSec = os.stat(logf)[ST_CTIME]
00610             ExecutionDateLast    = os.stat(logf)[ST_MTIME]
00611             if _verbose:
00612                 print "Execution (completion) date for %s was: %s" % (logf,ExecutionDateLast)
00613             if (ExecutionDateLastSec > ExecutionDateSec):
00614                 ExecutionDateSec = ExecutionDateLastSec
00615                 ExecutionDate    = ExecutionDateLast
00616                 
00617     if ExecutionDate == "":
00618         ExecutionDate = ExecutionDateLast
00619 
00620     return (ExecutionDate,LogFiles,date,cmsScimarkResults,cmsScimarkDir)
00621 
def createRegressHTML(reghtml,repdir,outd,CurrentCandle,htmNames):

def cmsPerfPublish::step_cmp (   x,
  y 
)

Definition at line 715 of file cmsPerfPublish.py.

00715                  :
00716     xstr = x
00717     ystr = y
00718     x_idx = -1
00719     y_idx = -1
00720     bestx_idx = -1
00721     besty_idx = -1
00722     sndbst_x = -1
00723     sndbst_y = -1
00724     last_x = -1
00725     last_y = -1        
00726     for i in range(len(Step)):
00727         stepreg = re.compile("^%s.*" % Step[i])
00728         # fallback
00729         if Step[i] in xstr and sndbst_x == -1:         
00730             last_x = i
00731         if Step[i] in ystr and sndbst_y == -1:                     
00732             last_y = i        
00733         # second best
00734         if xstr in Step[i] and bestx_idx == -1:         
00735             sndbst_x = i
00736         if ystr in Step[i] and besty_idx == -1:                     
00737             sndbst_y = i
00738         # next best
00739         if stepreg.search(xstr) and x_idx == -1: 
00740             bestx_idx = i # If an exact match has not been found but something similar has, set x best index
00741         if stepreg.search(ystr) and y_idx == -1:
00742             besty_idx = i # If an exact match has not been found but something similar has, set y best index
00743         # actual
00744         if Step[i] == xstr and x_idx == -1:
00745             x_idx = i     # if an exact match has been found then set x index
00746         if Step[i] == ystr and y_idx == -1:
00747             y_idx = i     # if an exact match has been found then set y index
00748         if not ( x_idx == -1 or y_idx == -1):
00749             break         # if an exact match has been found for both, stop
00750 
00751     # use best match if we still can't find indices
00752     if x_idx == -1:
00753         x_idx = bestx_idx
00754     if y_idx == -1:
00755         y_idx = besty_idx
00756 
00757     # use second best if we still can't find indices
00758     if x_idx == -1:
00759         x_idx = sndbst_x
00760     if y_idx == -1:
00761         y_idx = sndbst_y
00762 
00763     # use fallback if we still can't find indices
00764     if x_idx == -1:
00765         x_idx = last_x
00766     if y_idx == -1:
00767         y_idx = last_y
00768 
00769     if x_idx == -1 or y_idx == -1:
00770         print "WARNING: No valid step names could be found in the logfiles or root filenames being sorted: x: %s y: %s." % (xstr,ystr)
00771         print "x", x_idx, "y", y_idx
00772 
00773     if x_idx < y_idx:
00774         return -1
00775     elif x_idx == y_idx:
00776         return 0
00777     elif y_idx < x_idx:
00778         return 1
00779         
00780 
######################

def cmsPerfPublish::syncToRemoteLoc (   stage,
  drive,
  path,
  port 
)

Definition at line 1657 of file cmsPerfPublish.py.

01657                                           :
01658     stage = addtrailingslash(stage)
01659     cmd = "rsync -avz"
01660     # We must, MUST, do os.path.normpath otherwise rsync will dump the files in the directory
01661     # we specify on the remote server, rather than creating the CMS_VERSION directory
01662     #--rsh=\"ssh -l relval\" 
01663     args = "--port=%s %s %s:%s" % (port,os.path.normpath(stage),drive,path)
01664     retval = -1
01665     if _dryrun:
01666         print              cmd + " --dry-run " + args 
01667         retval = os.system(cmd + " --dry-run " + args )
01668     else:
01669         retval = os.system(cmd + " " + args)
01670     return retval
01671 
################

def cmsPerfPublish::syscp (   srcs,
  dest 
)

Definition at line 1797 of file cmsPerfPublish.py.

01797                     :
01798     if type(srcs) == type(""):
01799         if os.path.exists(srcs):
01800             if os.path.isdir(srcs):
01801                 copytree4(srcs,dest)
01802             else:
01803                 docopy(srcs,dest)
01804         else:
01805             print "ERROR: file to be copied %s does not exist" % foo            
01806     else:
01807         for src in srcs:
01808             if os.path.exists(src):
01809                 if os.path.isdir(src):
01810                 #copy tree
01811                     copytree4(src,dest)
01812                 else:
01813                     docopy(src,dest)
01814             else:
01815                 print "ERROR: file to be copied %s does not exist" % foo
01816             
def print_header():

def cmsPerfPublish::timerep_cmp (   x,
  y 
)

Definition at line 703 of file cmsPerfPublish.py.

00703                     :
00704     (fname,x) = x
00705     (fname,y) = y        
00706     x = os.path.basename(x)
00707     y = os.path.basename(y)
00708     stepreg = re.compile("%s_(..*)_TimingReport" % fname)
00709     if stepreg.search(x):
00710         x = stepreg.search(x).groups()[0]
00711     if stepreg.search(y):
00712         y = stepreg.search(y).groups()[0]
00713     return step_cmp(x,y)
00714 
def step_cmp(x,y):


Variable Documentation

int cmsPerfPublish::CallgrindNumOfEvents = 9999 [static]

Definition at line 32 of file cmsPerfPublish.py.

tuple cmsPerfPublish::cpDirFilter = ( ) [static]

Definition at line 28 of file cmsPerfPublish.py.

tuple cmsPerfPublish::cpFileFilter = ( "*.root", ) [static]

Definition at line 27 of file cmsPerfPublish.py.

string cmsPerfPublish::DEF_RELVAL = "/afs/cern.ch/cms/sdt/web/performance/RelVal" [static]

Definition at line 24 of file cmsPerfPublish.py.

string cmsPerfPublish::DEF_SIMUL = "/afs/cern.ch/cms/sdt/web/performance/simulation" [static]

Definition at line 25 of file cmsPerfPublish.py.

tuple cmsPerfPublish::DirName [static]

Initial value:

( #These need to match the candle directory names ending (depending on the type of profiling)
          "TimeSize",
          "IgProf",          
          "Callgrind",
         "Memcheck",
          #Adding the extra PU directories:
          "PU_TimeSize",
          "PU_IgProf",          
          "PU_Callgrind",
          "PU_Memcheck"
          )

Definition at line 35 of file cmsPerfPublish.py.

int cmsPerfPublish::IgProfNumOfEvents = 9999 [static]

Definition at line 31 of file cmsPerfPublish.py.

int cmsPerfPublish::MemcheckNumOfEvents = 9999 [static]

Definition at line 33 of file cmsPerfPublish.py.

tuple cmsPerfPublish::PROG_NAME = os.path.basename(sys.argv[0]) [static]

Definition at line 23 of file cmsPerfPublish.py.

tuple cmsPerfPublish::Steps = set(Step+ProductionSteps) [static]

Definition at line 47 of file cmsPerfPublish.py.

int cmsPerfPublish::TimeSizeNumOfEvents = 9999 [static]

Definition at line 30 of file cmsPerfPublish.py.

string cmsPerfPublish::TMP_DIR = "" [static]

Definition at line 26 of file cmsPerfPublish.py.


Generated on Tue Jun 9 18:36:41 2009 for CMSSW by  doxygen 1.5.4