From 43bf7d3410e24d6a9c7b94a3deb3ac4addc9a848 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 12 Aug 2015 12:58:56 +0100 Subject: [PATCH] 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. --- treeherder/log_parser/artifactbuilders.py | 3 +++ treeherder/log_parser/parsers.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/treeherder/log_parser/artifactbuilders.py b/treeherder/log_parser/artifactbuilders.py index ed0fbc175..ba06ec4ea 100644 --- a/treeherder/log_parser/artifactbuilders.py +++ b/treeherder/log_parser/artifactbuilders.py @@ -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) diff --git a/treeherder/log_parser/parsers.py b/treeherder/log_parser/parsers.py index f1793f7d1..d2f0e3983 100644 --- a/treeherder/log_parser/parsers.py +++ b/treeherder/log_parser/parsers.py @@ -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