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:
parent
6ba2b33a8c
commit
3f3b0a28f2
|
@ -232,7 +232,7 @@ def _call_proxy(fn, *args):
|
||||||
|
|
||||||
|
|
||||||
class LAVAJob:
|
class LAVAJob:
|
||||||
COLOR_STATUS_MAP = {"pass": CONSOLE_LOG["COLOR_GREEN"]}
|
COLOR_STATUS_MAP = {"pass": CONSOLE_LOG["FG_GREEN"]}
|
||||||
|
|
||||||
def __init__(self, proxy, definition):
|
def __init__(self, proxy, definition):
|
||||||
self.job_id = None
|
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
|
max_idle_time_min = max_idle_time.total_seconds() / 60
|
||||||
print_log(
|
print_log(
|
||||||
f"{CONSOLE_LOG['BOLD']}"
|
f"{CONSOLE_LOG['BOLD']}"
|
||||||
f"{CONSOLE_LOG['COLOR_RED']}"
|
f"{CONSOLE_LOG['FG_RED']}"
|
||||||
f"No log output for {max_idle_time_min} minutes; "
|
f"No log output for {max_idle_time_min} minutes; "
|
||||||
"assuming device has died, retrying"
|
"assuming device has died, retrying"
|
||||||
f"{CONSOLE_LOG['RESET']}"
|
f"{CONSOLE_LOG['RESET']}"
|
||||||
|
@ -446,7 +446,7 @@ def print_job_final_status(job):
|
||||||
if job.status == "running":
|
if job.status == "running":
|
||||||
job.status = "hung"
|
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(
|
print_log(
|
||||||
f"{color}"
|
f"{color}"
|
||||||
f"LAVA Job finished with status: {job.status}"
|
f"LAVA Job finished with status: {job.status}"
|
||||||
|
|
|
@ -37,10 +37,9 @@ from typing import Optional, Pattern, Union
|
||||||
|
|
||||||
from lava.exceptions import MesaCITimeoutError
|
from lava.exceptions import MesaCITimeoutError
|
||||||
|
|
||||||
# Helper constants to colorize the job output
|
|
||||||
CONSOLE_LOG = {
|
CONSOLE_LOG = {
|
||||||
"COLOR_GREEN": "\x1b[1;32;5;197m",
|
"FG_GREEN": "\x1b[1;32;5;197m",
|
||||||
"COLOR_RED": "\x1b[1;38;5;197m",
|
"FG_RED": "\x1b[1;38;5;197m",
|
||||||
"RESET": "\x1b[0m",
|
"RESET": "\x1b[0m",
|
||||||
"UNDERLINED": "\x1b[3m",
|
"UNDERLINED": "\x1b[3m",
|
||||||
"BOLD": "\x1b[1m",
|
"BOLD": "\x1b[1m",
|
||||||
|
@ -76,7 +75,7 @@ class GitlabSection:
|
||||||
type: LogSectionType
|
type: LogSectionType
|
||||||
start_collapsed: bool = False
|
start_collapsed: bool = False
|
||||||
escape: str = "\x1b[0K"
|
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)
|
__start_time: Optional[datetime] = field(default=None, init=False)
|
||||||
__end_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"]:
|
if line["lvl"] in ["results", "feedback", "debug"]:
|
||||||
return
|
return
|
||||||
elif line["lvl"] in ["warning", "error"]:
|
elif line["lvl"] in ["warning", "error"]:
|
||||||
prefix = CONSOLE_LOG["COLOR_RED"]
|
prefix = CONSOLE_LOG["FG_RED"]
|
||||||
suffix = CONSOLE_LOG["RESET"]
|
suffix = CONSOLE_LOG["RESET"]
|
||||||
elif line["lvl"] == "input":
|
elif line["lvl"] == "input":
|
||||||
prefix = "$ "
|
prefix = "$ "
|
||||||
|
|
Loading…
Reference in New Issue