Bug 1316692 - Upload talos results as json artifact; r=jmaher
authorRob Wood <rwood@mozilla.com>
Fri, 16 Dec 2016 10:31:06 -0500
changeset 326204 bcd5a036290cb61fd70636b04907d6737d12b512
parent 326203 3d4f10649284edd6397e57052411b213cb24ca62
child 326205 b62bae8d1375363b0416d3aae5a65ebf9f8eac2e
push id31092
push userphilringnalda@gmail.com
push dateSat, 17 Dec 2016 22:00:04 +0000
treeherdermozilla-central@881ef8c0e232 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1316692
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1316692 - Upload talos results as json artifact; r=jmaher MozReview-Commit-ID: 3aehYIknuDR
testing/mozharness/mozharness/mozilla/testing/talos.py
--- a/testing/mozharness/mozharness/mozilla/testing/talos.py
+++ b/testing/mozharness/mozharness/mozilla/testing/talos.py
@@ -7,16 +7,17 @@
 """
 run talos tests in a virtualenv
 """
 
 import os
 import pprint
 import copy
 import re
+import shutil
 import json
 
 import mozharness
 from mozharness.base.config import parse_config_file
 from mozharness.base.errors import PythonErrorList
 from mozharness.base.log import OutputParser, DEBUG, ERROR, CRITICAL
 from mozharness.base.log import INFO, WARNING
 from mozharness.mozilla.blob_upload import BlobUploadMixin, blobupload_config_options
@@ -407,16 +408,24 @@ class Talos(TestingMixin, MercurialScrip
             with open(schema_path) as f:
                 schema = json.load(f)
             data = json.loads(parser.found_perf_data[0])
             jsonschema.validate(data, schema)
         except:
             self.exception("Error while validating PERFHERDER_DATA")
             parser.update_worst_log_and_tbpl_levels(WARNING, TBPL_WARNING)
 
+    def _artifact_perf_data(self, dest):
+        src = os.path.join(self.query_abs_dirs()['abs_work_dir'], 'local.json')
+        try:
+            shutil.copyfile(src, dest)
+        except:
+            self.critical("Error copying results %s to upload dir %s" % (src, dest))
+            parser.update_worst_log_and_tbpl_levels(CRITICAL, TBPL_FAILURE)
+
     def run_tests(self, args=None, **kw):
         """run Talos tests"""
 
         # get talos options
         options = self.talos_options(args=args, **kw)
 
         # XXX temporary python version check
         python = self.query_python_path()
@@ -472,11 +481,15 @@ class Talos(TestingMixin, MercurialScrip
             if self.return_code == 4:
                 log_level = WARNING
                 tbpl_level = TBPL_RETRY
 
             parser.update_worst_log_and_tbpl_levels(log_level, tbpl_level)
         else:
             if not self.sps_profile:
                 self._validate_treeherder_data(parser)
+                if not self.run_local:
+                    # copy results to upload dir so they are included as an artifact
+                    dest = os.path.join(env['MOZ_UPLOAD_DIR'], 'perfherder-data.json')
+                    self._artifact_perf_data(dest)
 
         self.buildbot_status(parser.worst_tbpl_status,
                              level=parser.worst_log_level)