ci/lava: Rename console color names

Use FG to indicate foreground colors

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16323>
This commit is contained in:
Guilherme Gallo 2022-07-05 21:33:30 -03:00 committed by Marge Bot
parent 6ba2b33a8c
commit 3f3b0a28f2
2 changed files with 7 additions and 8 deletions

View File

@ -232,7 +232,7 @@ def _call_proxy(fn, *args):
class LAVAJob:
COLOR_STATUS_MAP = {"pass": CONSOLE_LOG["COLOR_GREEN"]}
COLOR_STATUS_MAP = {"pass": CONSOLE_LOG["FG_GREEN"]}
def __init__(self, proxy, definition):
self.job_id = None
@ -370,7 +370,7 @@ def fetch_logs(job, max_idle_time, log_follower) -> None:
max_idle_time_min = max_idle_time.total_seconds() / 60
print_log(
f"{CONSOLE_LOG['BOLD']}"
f"{CONSOLE_LOG['COLOR_RED']}"
f"{CONSOLE_LOG['FG_RED']}"
f"No log output for {max_idle_time_min} minutes; "
"assuming device has died, retrying"
f"{CONSOLE_LOG['RESET']}"
@ -446,7 +446,7 @@ def print_job_final_status(job):
if job.status == "running":
job.status = "hung"
color = LAVAJob.COLOR_STATUS_MAP.get(job.status, CONSOLE_LOG["COLOR_RED"])
color = LAVAJob.COLOR_STATUS_MAP.get(job.status, CONSOLE_LOG["FG_RED"])
print_log(
f"{color}"
f"LAVA Job finished with status: {job.status}"

View File

@ -37,10 +37,9 @@ from typing import Optional, Pattern, Union
from lava.exceptions import MesaCITimeoutError
# Helper constants to colorize the job output
CONSOLE_LOG = {
"COLOR_GREEN": "\x1b[1;32;5;197m",
"COLOR_RED": "\x1b[1;38;5;197m",
"FG_GREEN": "\x1b[1;32;5;197m",
"FG_RED": "\x1b[1;38;5;197m",
"RESET": "\x1b[0m",
"UNDERLINED": "\x1b[3m",
"BOLD": "\x1b[1m",
@ -76,7 +75,7 @@ class GitlabSection:
type: LogSectionType
start_collapsed: bool = False
escape: str = "\x1b[0K"
colour: str = f"{CONSOLE_LOG['BOLD']}{CONSOLE_LOG['COLOR_GREEN']}"
colour: str = f"{CONSOLE_LOG['BOLD']}{CONSOLE_LOG['FG_GREEN']}"
__start_time: Optional[datetime] = field(default=None, init=False)
__end_time: Optional[datetime] = field(default=None, init=False)
@ -342,7 +341,7 @@ def parse_lava_line(line) -> Optional[str]:
if line["lvl"] in ["results", "feedback", "debug"]:
return
elif line["lvl"] in ["warning", "error"]:
prefix = CONSOLE_LOG["COLOR_RED"]
prefix = CONSOLE_LOG["FG_RED"]
suffix = CONSOLE_LOG["RESET"]
elif line["lvl"] == "input":
prefix = "$ "