Bug 1287283 - Fail job if mozharness perfherder data does not match schema r?gps draft
authorWilliam Lachance <wlachance@mozilla.com>
Tue, 19 Jul 2016 13:55:38 -0400
changeset 389656 9c7c01884ed894a7ef5f6a460ec868fb298474a1
parent 389655 5c5c0105b0c5b7aa47f9448a93128c7ebf8b8be3
child 525816 ede7cd8f24e80e3fd120c6b64bccb9976b0d699d
push id23477
push userwlachance@mozilla.com
push dateTue, 19 Jul 2016 19:17:03 +0000
reviewersgps
bugs1287283
milestone50.0a1
Bug 1287283 - Fail job if mozharness perfherder data does not match schema r?gps MozReview-Commit-ID: 6RKmH4GiXHY
testing/mozharness/mozharness/base/python.py
--- a/testing/mozharness/mozharness/base/python.py
+++ b/testing/mozharness/mozharness/base/python.py
@@ -633,28 +633,28 @@ class ResourceMonitoringMixin(object):
                     'subtests': subtests,
                 })
 
             data = {
                 'framework': {'name': 'job_resource_usage'},
                 'suites': suites,
             }
 
-            try:
-                schema_path = os.path.join(external_tools_path,
-                                           'performance-artifact-schema.json')
-                with open(schema_path, 'rb') as fh:
-                    schema = json.load(fh)
+            schema_path = os.path.join(external_tools_path,
+                                       'performance-artifact-schema.json')
+            with open(schema_path, 'rb') as fh:
+                schema = json.load(fh)
 
-                self.info('Validating Perfherder data against %s' % schema_path)
-                jsonschema.validate(data, schema)
-            except Exception:
-                self.exception('error while validating Perfherder data; ignoring')
-            else:
-                self.info('PERFHERDER_DATA: %s' % json.dumps(data))
+            # this will throw an exception that causes the job to fail if the
+            # perfherder data is not valid -- please don't change this
+            # behaviour, otherwise people will inadvertently break this
+            # functionality
+            self.info('Validating Perfherder data against %s' % schema_path)
+            jsonschema.validate(data, schema)
+            self.info('PERFHERDER_DATA: %s' % json.dumps(data))
 
         log_usage('Total resource usage', duration, cpu_percent, cpu_times, io)
 
         # Print special messages so usage shows up in Treeherder.
         if cpu_percent:
             self._tinderbox_print('CPU usage<br/>{:,.1f}%'.format(
                                   cpu_percent))