Bug 1519862 - Handle unstructured lines in mozlog output better in mozharness, r=ahal
authorJames Graham <james@hoppipolla.co.uk>
Thu, 10 Jan 2019 11:05:54 +0000
changeset 515069 f7f763f7c5b4771be1809898a9455ceec1d88515
parent 515068 a2e2dd4e45395ca8173191b53851f0c7a24db77f
child 515070 765ec7f392431213b37a7faa1e9ffbc4ccbba85b
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1519862
milestone66.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 1519862 - Handle unstructured lines in mozlog output better in mozharness, r=ahal Instead of printing one log message per line about the fact the output was unstructured, just print one per group of unstructured lines. Differential Revision: https://phabricator.services.mozilla.com/D16834
testing/mozharness/mozharness/mozilla/structuredlog.py
--- a/testing/mozharness/mozharness/mozilla/structuredlog.py
+++ b/testing/mozharness/mozharness/mozilla/structuredlog.py
@@ -41,16 +41,17 @@ class StructuredOutputParser(OutputParse
         mozlog = self._get_mozlog_module()
         self.formatter = mozlog.formatters.TbplFormatter(compact=tbpl_compact)
         self.handler = mozlog.handlers.StatusHandler()
         self.log_actions = mozlog.structuredlog.log_actions()
 
         self.worst_log_level = INFO
         self.tbpl_status = TBPL_SUCCESS
         self.harness_retry_re = TinderBoxPrintRe['harness_error']['retry_regex']
+        self.prev_was_unstructured = False
 
     def _get_mozlog_module(self):
         try:
             import mozlog
         except ImportError:
             self.fatal("A script class using structured logging must inherit "
                        "from the MozbaseMixin to ensure that mozlog is available.")
         return mozlog
@@ -73,23 +74,29 @@ class StructuredOutputParser(OutputParse
             if (isinstance(candidate_data, dict) and
                'action' in candidate_data and candidate_data['action'] in self.log_actions):
                 data = candidate_data
         except ValueError:
             pass
 
         if data is None:
             if self.strict:
-                self.critical(("Test harness output was not a valid structured log message: "
-                              "\n%s") % line)
+                if not self.prev_was_unstructured:
+                    self.critical(("Test harness output was not a valid structured log message: "
+                                   "\n%s") % line)
+                else:
+                    self.critical(line)
                 self.update_levels(TBPL_FAILURE, log.CRITICAL)
+                self.prev_was_unstructured = True
             else:
                 self._handle_unstructured_output(line)
             return
 
+        self.prev_was_unstructured = False
+
         self.handler(data)
 
         action = data["action"]
         if action in ('log', 'process_output'):
             if action == 'log':
                 message = data['message']
                 level = getattr(log, data['level'].upper())
             else: