Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: buildbot_gentoo_ci/logs/
Date: Thu, 03 Feb 2022 21:23:47
Message-Id: 1643923408.57d8ef85943af7ddfeaa51d0cacdacba80a75a13.zorry@gentoo
1 commit: 57d8ef85943af7ddfeaa51d0cacdacba80a75a13
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 3 21:23:28 2022 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 3 21:23:28 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=57d8ef85
7
8 Fix UnicodeDecodeError in log parser
9
10 Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org>
11
12 buildbot_gentoo_ci/logs/log_parser.py | 11 ++++-------
13 1 file changed, 4 insertions(+), 7 deletions(-)
14
15 diff --git a/buildbot_gentoo_ci/logs/log_parser.py b/buildbot_gentoo_ci/logs/log_parser.py
16 index 7531532..448192c 100644
17 --- a/buildbot_gentoo_ci/logs/log_parser.py
18 +++ b/buildbot_gentoo_ci/logs/log_parser.py
19 @@ -166,13 +166,10 @@ def runLogParser(args):
20 # Is stored in a db instead of files.
21 log_search_pattern_list = get_log_search_pattern(Session, args.uuid, config['default_uuid'])
22 Session.close()
23 - #FIXME: UnicodeDecodeError: 'utf-8' codec can't decode byte ... in some logs
24 - with io.TextIOWrapper(io.BufferedReader(gzip.open(args.file, 'rb'))) as f:
25 - for text_line in f:
26 - logfile_text_dict[index] = text_line.strip('\n')
27 - index = index + 1
28 - max_text_lines = index
29 - f.close()
30 + for text_line in io.TextIOWrapper(io.BufferedReader(gzip.open(args.file)), encoding='utf8', errors='ignore'):
31 + logfile_text_dict[index] = text_line.strip('\n')
32 + index = index + 1
33 + max_text_lines = index
34 # run the parse patten on the line
35 for tmp_index, text in logfile_text_dict.items():
36 res = mp_pool.apply_async(search_buildlog, (log_search_pattern_list, logfile_text_dict, tmp_index, max_text_lines,))