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@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15938>
This commit is contained in:
parent
84a5ea4228
commit
43d8ed840e
|
@ -297,6 +297,26 @@ def show_job_data(job):
|
||||||
print("{}\t: {}".format(field, value))
|
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):
|
def follow_job_execution(job):
|
||||||
try:
|
try:
|
||||||
job.submit()
|
job.submit()
|
||||||
|
@ -326,8 +346,9 @@ def follow_job_execution(job):
|
||||||
time.sleep(LOG_POLLING_TIME_SEC)
|
time.sleep(LOG_POLLING_TIME_SEC)
|
||||||
|
|
||||||
new_lines = job.get_logs()
|
new_lines = job.get_logs()
|
||||||
|
parsed_lines = parse_lava_lines(new_lines)
|
||||||
|
|
||||||
for line in new_lines:
|
for line in parsed_lines:
|
||||||
print(line)
|
print(line)
|
||||||
|
|
||||||
show_job_data(job)
|
show_job_data(job)
|
||||||
|
|
Loading…
Reference in New Issue