Skip to content
Snippets Groups Projects
Commit ce3b548e authored by Maciej Pawel Szymanski's avatar Maciej Pawel Szymanski
Browse files

Merge branch 'maszyman-velo-upgrade' into 'master'

add clone rate to the output

See merge request !73
parents 1d776d42 7a552834
No related branches found
No related tags found
1 merge request!73add clone rate to the output
......@@ -39,12 +39,12 @@ class UpgradePrCheckerHandler(BaseHandler):
if not foundtrackingcategory or not foundfakestracks:
return None
else:
return (efficiency, fakeRate)
return (efficiency, fakeRate, clone_rate)
def collectResultsExt(self, directory, project, version, platform, hostname, startTime, endTime):
# get efficiency and fake rate from PRChecker log
efficiency, fake_rate = self.extractPerf(os.path.join(directory, "run.log"))
efficiency, fake_rate, clone_rate = self.extractPerf(os.path.join(directory, "run.log"))
# save floats and string with path to plot
self.saveFloat("efficiency",
......@@ -55,6 +55,10 @@ class UpgradePrCheckerHandler(BaseHandler):
fake_rate,
description="fake rate",
group="performance")
self.saveFloat("clone_rate",
clone_rate,
description="clone rate",
group="performance")
# send plot to eos as html
wwwDirEos = os.environ.get("LHCBPR_WWW_EOS")
......@@ -69,6 +73,7 @@ class UpgradePrCheckerHandler(BaseHandler):
"<ul>"\
" <li>Efficiency = "+str(efficiency)+" </li>"\
" <li>Fake rate = "+str(fake_rate)+"</li>"\
" <li>Clone rate = "+str(clone_rate)+"</li>"\
"</ul>"\
"</body>"\
"</html>"
......
import os
import re
import sys
import subprocess
import glob
from BaseHandler import BaseHandler
class VeloUpgradeHandler(BaseHandler):
def __init__(self):
super(self.__class__, self).__init__()
def extractPerf(self, infile, trackingtype="Velo", trackingcat="07"):
filetoread = open(infile,'r')
foundtrackingtype = False
foundtrackingcategory = False
foundfakestracks = False
for line in filetoread:
if not foundtrackingtype:
if line.find('**** '+trackingtype) > -1:
foundtrackingtype = True
if line.find("ghosts") > -1 and not foundfakestracks:
tracksFound = line.split('tracks including')[0].split(trackingtype)[1].lstrip(' ')
fakesFound = line.split('tracks including')[1].split("ghosts")[0].lstrip(' ')
fakeRate = line.split('tracks including')[1].split("ghosts")[1].split('[')[1].split(']')[0].lstrip(' ').rstrip(' %')
print "Nb. Tracks Found = "+tracksFound
print "Nb. Fakes Found = "+fakesFound+ " [ "+fakeRate +" %]"
#print 'Velo tracking found =',line.split('tracks including')[0].split(trackingtype)[1].lstrip(' ')
foundfakestracks = True
else:
if line.find(trackingcat) > -1:
efficiency = float(line.split('[')[1].split(']')[0].lstrip(' ').rstrip(' %'))
clone_rate = 100.0-float(line.split('purity:')[1].split('%')[0].lstrip(' '))
print 'efficiency = ', efficiency
print 'clone rate = ', clone_rate
foundtrackingcategory = True
break
if not foundtrackingcategory or not foundfakestracks:
return None
else:
return (efficiency, fakeRate)
def collectResultsExt(self, directory, project, version, platform, hostname, startTime, endTime):
# clone lhcb-benchmark scripts
if not os.path.exists("lhcb-benchmark-scripts"):
rc = subprocess.call("git clone --quiet ssh://git@gitlab.cern.ch:7999/sponce/lhcb-benchmark-scripts.git",
shell=True)
# run extract.py from directory
subprocess.call(["lb-run",
"LHCb/latest",
"python",
"lhcb-benchmark-scripts/extract.py",
directory])
# run plotSpeedUp.py
max_throughput_nt = subprocess.check_output(["lb-run",
"LHCb/latest",
"python",
"lhcb-benchmark-scripts/plotSpeedup.py",
"extractedData"])
max_throughput = float(max_throughput_nt.split(" ")[0])
max_nt = int(max_throughput_nt.split(" ")[1])
print("max_throughput = ", max_throughput)
print("max_nt = ", max_nt)
self.saveFloat("max_throughput",
max_throughput,
description="maximum throughput",
group="throughput")
# run plotAlgoUsage.py on a csv file which has max throughput
subprocess.call(["lb-run",
"LHCb/latest",
"python",
"lhcb-benchmark-scripts/plotAlgoUsage.py",
glob.glob(directory+"/*"+str(max_nt)+"t*csv")[0]])
# get efficiency and fake rate from PRChecker log
efficiency, fake_rate = self.extractPerf(os.path.join(directory, "run.log"))
# save floats and string with path to plot
self.saveFloat("efficiency",
efficiency,
description="efficiency",
group="performance")
self.saveFloat("fake_rate",
fake_rate,
description="fake rate",
group="performance")
# send plot to eos as html
wwwDirEos = os.environ.get("LHCBPR_WWW_EOS")
if wwwDirEos == None:
raise Exception("No web dir on EOS defined, will not run extraction")
else:
import datetime
i = datetime.datetime.now()
dirname = str(version) + "_" + i.strftime("%Y-%m-%dT%H:%M:%S")
html_code = "<html>"\
"<head></head> "\
"<body> "\
"<p>"+str(version)+"</p>"\
"<ul>"\
" <li>Maximum throughput = "+str(max_throughput)+"</li>"\
" <li>Efficiency = "+str(efficiency)+"</li>"\
" <li>Fake rate = "+str(fake_rate)+"</li>"\
"</ul>"\
"<img src="'throughput.png'">"\
"<img src="'algousage.png'">"\
"</body>"\
"</html>"
with open("index.html", "w") as html_file:
html_file.write(html_code)
# os.makedirs(dirname)
# LHCBPR_WWW_EOS should be set to root://eoslhcb.cern.ch//eos/lhcb/storage/lhcbpr/UpgradeVelo/www/
# for test: root://eoslhcb.cern.ch//eos/lhcb/user/m/maszyman/www
targetRootEosDir = os.path.join(wwwDirEos, dirname)
try:
subprocess.call(['xrdcp', 'throughput.png', targetRootEosDir + "/throughput.png"])
subprocess.call(['xrdcp', 'algousage.png', targetRootEosDir + "/algousage.png"])
subprocess.call(['xrdcp', 'index.html', targetRootEosDir + "/index.html"])
except Exception, ex:
logging.warning('Error copying html files to eos: %s', ex)
self.saveString("throughput",
"cern.ch/lhcbpr-hlt/PerfTests/UpgradeVelo/"+dirname+"throughput.png",
description="link to throughput vs parallelisation plot",
group="performance")
self.saveString("algousage",
"cern.ch/lhcbpr-hlt/PerfTests/UpgradeVelo/"+dirname+"algousage.png",
description="link to algo usage plot",
group="performance")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment