Mesa (main): ci/lava: Rename console color names
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 7 00:55:35 UTC 2022
Module: Mesa
Branch: main
Commit: 3f3b0a28f2f90fff3cfa8b1bdcad8b9f77d31b1a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f3b0a28f2f90fff3cfa8b1bdcad8b9f77d31b1a
Author: Guilherme Gallo <guilherme.gallo at collabora.com>
Date: Tue Jul 5 21:33:30 2022 -0300
ci/lava: Rename console color names
Use FG to indicate foreground colors
Signed-off-by: Guilherme Gallo <guilherme.gallo at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16323>
---
.gitlab-ci/lava/lava_job_submitter.py | 6 +++---
.gitlab-ci/lava/utils/lava_log.py | 9 ++++-----
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/.gitlab-ci/lava/lava_job_submitter.py b/.gitlab-ci/lava/lava_job_submitter.py
index 88332303513..5150f0039c2 100755
--- a/.gitlab-ci/lava/lava_job_submitter.py
+++ b/.gitlab-ci/lava/lava_job_submitter.py
@@ -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}"
diff --git a/.gitlab-ci/lava/utils/lava_log.py b/.gitlab-ci/lava/utils/lava_log.py
index 36b2979831e..6f914d71c91 100644
--- a/.gitlab-ci/lava/utils/lava_log.py
+++ b/.gitlab-ci/lava/utils/lava_log.py
@@ -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 = "$ "
More information about the mesa-commit
mailing list