Bug 1506254 - Support TBPL_RETRY in structured logger, to enable task retry; r=jmaher

This commit is contained in:
Geoff Brown 2018-11-21 07:46:45 -07:00
Родитель 046994a7fc
Коммит 877a1c2411
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -9,6 +9,8 @@ from mozharness.base import log
from mozharness.base.log import OutputParser, WARNING, INFO, ERROR
from mozharness.mozilla.automation import TBPL_WARNING, TBPL_FAILURE
from mozharness.mozilla.automation import TBPL_SUCCESS, TBPL_WORST_LEVEL_TUPLE
from mozharness.mozilla.automation import TBPL_RETRY
from mozharness.mozilla.testing.errors import TinderBoxPrintRe
from mozharness.mozilla.testing.unittest import tbox_print_summary
from collections import (
@ -43,6 +45,7 @@ class StructuredOutputParser(OutputParser):
self.worst_log_level = INFO
self.tbpl_status = TBPL_SUCCESS
self.harness_retry_re = TinderBoxPrintRe['harness_error']['retry_regex']
def _get_mozlog_module(self):
try:
@ -99,6 +102,11 @@ class StructuredOutputParser(OutputParser):
if error_level is not None:
level = self.worst_level(error_level, level)
if self.harness_retry_re.search(message):
self.update_levels(TBPL_RETRY, log.CRITICAL)
tbpl_level = TBPL_RETRY
level = log.CRITICAL
log_data = self.formatter(data)
if log_data is not None:
self.log(log_data, level=level)
@ -135,6 +143,9 @@ class StructuredOutputParser(OutputParser):
defaultdict(int),
defaultdict(int))
if previous_summary:
# Always preserve retry status: if any failure triggers retry, the script
# must exit with TBPL_RETRY to trigger task retry.
if self.tbpl_status != TBPL_RETRY:
self.tbpl_status = TBPL_SUCCESS
joined_summary = summary