Bug 1193715 - Mark TalosParser complete once the TALOSDATA log line seen

There is only ever one TALOSDATA line in a log file, so once it has been
seen there is no need to run TalosParser against later log lines.
This commit is contained in:
Ed Morley 2015-08-12 12:58:56 +01:00
Родитель 475f427860
Коммит 43bf7d3410
2 изменённых файлов: 6 добавлений и 0 удалений

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

@ -55,6 +55,9 @@ class ArtifactBuilderBase(object):
line = line[:self.MAX_LINE_LENGTH]
for parser in self.parsers:
# Some parsers only need to run until they've seen a specific line.
# Once that's occurred, they mark themselves as complete, to save
# being included in the set of parsers run against later log lines.
if not parser.complete:
parser.parse_line(line, self.lineno)

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

@ -347,3 +347,6 @@ class TalosParser(ParserBase):
# this will throw an exception if the json parsing breaks, but
# that's the behaviour we want
self.artifact = json.loads(match.group(1))
# Mark this parser as complete, so we don't continue to run
# it against every remaining line in the log.
self.complete = True