summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2018-10-22 11:29:39 -0400
committerTodd Gamblin <tgamblin@llnl.gov>2018-12-20 09:23:08 -0800
commitaed9a532c6edb24f336aa8a5114ad465b22c318c (patch)
treea9429005637c1e183c2f18c2727429fe96c56e7b /lib
parent738d2bd77a7419fd4e2831a71ba512d4ed8ad93a (diff)
downloadspack-aed9a532c6edb24f336aa8a5114ad465b22c318c.tar.gz
spack-aed9a532c6edb24f336aa8a5114ad465b22c318c.tar.bz2
spack-aed9a532c6edb24f336aa8a5114ad465b22c318c.tar.xz
spack-aed9a532c6edb24f336aa8a5114ad465b22c318c.zip
Get buildId from CDash at submit time
Pass extra data when submitting to CDash. If CDash responds with a buildId, construct and display helpful URL that links to the uploaded report.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/reporters/cdash.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/spack/spack/reporters/cdash.py b/lib/spack/spack/reporters/cdash.py
index 068f9275b7..2f74e4ec0d 100644
--- a/lib/spack/spack/reporters/cdash.py
+++ b/lib/spack/spack/reporters/cdash.py
@@ -63,6 +63,7 @@ class CDash(Reporter):
buildstamp_format = "%Y%m%d-%H%M-{0}".format(args.cdash_track)
self.buildstamp = time.strftime(buildstamp_format,
time.localtime(self.starttime))
+ self.buildId = None
def build_report(self, filename, report_data):
self.initialize_report(filename, report_data)
@@ -159,6 +160,7 @@ class CDash(Reporter):
t = env.get_template(phase_template)
f.write(t.render(report_data))
self.upload(phase_report)
+ self.print_cdash_link()
def concretization_report(self, filename, msg):
report_data = {}
@@ -174,6 +176,7 @@ class CDash(Reporter):
with open(output_filename, 'w') as f:
f.write(t.render(report_data))
self.upload(output_filename)
+ self.print_cdash_link()
def initialize_report(self, filename, report_data):
if not os.path.exists(filename):
@@ -191,13 +194,29 @@ class CDash(Reporter):
# Compute md5 checksum for the contents of this file.
md5sum = checksum(hashlib.md5, filename, block_size=8192)
+ buildid_regexp = re.compile("<buildId>([0-9]+)</buildId>")
opener = build_opener(HTTPHandler)
with open(filename, 'rb') as f:
- url = "{0}&MD5={1}".format(self.cdash_upload_url, md5sum)
+ url = "{0}&build={1}&site={2}&stamp={3}&MD5={4}".format(
+ self.cdash_upload_url, self.buildname, self.site,
+ self.buildstamp, md5sum)
request = Request(url, data=f)
request.add_header('Content-Type', 'text/xml')
request.add_header('Content-Length', os.path.getsize(filename))
# By default, urllib2 only support GET and POST.
# CDash needs expects this file to be uploaded via PUT.
request.get_method = lambda: 'PUT'
- url = opener.open(request)
+ response = opener.open(request)
+ if not self.buildId:
+ match = buildid_regexp.search(response.read())
+ if match:
+ self.buildId = match.group(1)
+
+ def print_cdash_link(self):
+ if self.buildId:
+ # Construct and display a helpful link if CDash responded with
+ # a buildId.
+ build_url = self.cdash_upload_url
+ build_url = build_url[0:build_url.find("submit.php")]
+ build_url += "buildSummary.php?buildid={0}".format(self.buildId)
+ print("View your build results here:\n {0}\n".format(build_url))