Mesa (main): ci/lava: Filter log lines from LAVA return
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 28 07:34:16 UTC 2022
Module: Mesa
Branch: main
Commit: 43d8ed840ed697b435219a36ebd986a5113c2108
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=43d8ed840ed697b435219a36ebd986a5113c2108
Author: Guilherme Gallo <guilherme.gallo at collabora.com>
Date: Thu Apr 14 14:58:55 2022 -0300
ci/lava: Filter log lines from LAVA return
Start to differentiate between the different types of LAVA log message;
the only visible change right now is that we make warnings and errors
bold and red to match bare-metal, but it comes in useful later as we
will use the results markers to watch us step through the different
stages of job execution.
Signed-off-by: Guilherme Gallo <guilherme.gallo at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15938>
---
.gitlab-ci/lava/lava_job_submitter.py | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/.gitlab-ci/lava/lava_job_submitter.py b/.gitlab-ci/lava/lava_job_submitter.py
index 406a0dd3095..11ee4650887 100755
--- a/.gitlab-ci/lava/lava_job_submitter.py
+++ b/.gitlab-ci/lava/lava_job_submitter.py
@@ -297,6 +297,26 @@ def show_job_data(job):
print("{}\t: {}".format(field, value))
+def parse_lava_lines(new_lines) -> list[str]:
+ parsed_lines: list[str] = []
+ for line in new_lines:
+ if line["lvl"] in ["results", "feedback"]:
+ continue
+ elif line["lvl"] in ["warning", "error"]:
+ prefix = "\x1b[1;38;5;197m"
+ suffix = "\x1b[0m"
+ elif line["lvl"] == "input":
+ prefix = "$ "
+ suffix = ""
+ else:
+ prefix = ""
+ suffix = ""
+ line = f'{prefix}{line["msg"]}{suffix}'
+ parsed_lines.append(line)
+
+ return parsed_lines
+
+
def follow_job_execution(job):
try:
job.submit()
@@ -326,8 +346,9 @@ def follow_job_execution(job):
time.sleep(LOG_POLLING_TIME_SEC)
new_lines = job.get_logs()
+ parsed_lines = parse_lava_lines(new_lines)
- for line in new_lines:
+ for line in parsed_lines:
print(line)
show_job_data(job)
More information about the mesa-commit
mailing list