bin/ci: crnm: Reduce trace cluttering
Some recurrent messages are only cluttering the ci_run_n_monitor's logs, so let's use the easily provided @cache decorator to print stuff that the user will only needs to see once. Also removes some junk that can happen during the pipeline monitoring loop, like the "----" line break, and newlines. Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30361>
This commit is contained in:

committed by
Marge Bot

parent
ff18d1ec23
commit
0acc31a001
@@ -33,6 +33,7 @@ from gitlab_common import (
|
|||||||
get_gitlab_project,
|
get_gitlab_project,
|
||||||
get_token_from_default_dir,
|
get_token_from_default_dir,
|
||||||
pretty_duration,
|
pretty_duration,
|
||||||
|
print_once,
|
||||||
read_token,
|
read_token,
|
||||||
wait_for_pipeline,
|
wait_for_pipeline,
|
||||||
)
|
)
|
||||||
@@ -79,9 +80,9 @@ def print_job_status(
|
|||||||
|
|
||||||
duration = job_duration(job)
|
duration = job_duration(job)
|
||||||
|
|
||||||
print(
|
print_once(
|
||||||
STATUS_COLORS[job.status]
|
STATUS_COLORS[job.status]
|
||||||
+ "🞋 target job " # U+1F78B Round target
|
+ "🞋 job " # U+1F78B Round target
|
||||||
+ link2print(job.web_url, job.name, job_name_field_pad)
|
+ link2print(job.web_url, job.name, job_name_field_pad)
|
||||||
+ (f"has new status: {job.status}" if new_status else f"{job.status}")
|
+ (f"has new status: {job.status}" if new_status else f"{job.status}")
|
||||||
+ (f" ({pretty_duration(duration)})" if job.started_at else "")
|
+ (f" ({pretty_duration(duration)})" if job.started_at else "")
|
||||||
@@ -206,10 +207,8 @@ def monitor_pipeline(
|
|||||||
pretty_wait(REFRESH_WAIT_JOBS)
|
pretty_wait(REFRESH_WAIT_JOBS)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print("---------------------------------", flush=False)
|
|
||||||
|
|
||||||
if jobs_waiting:
|
if jobs_waiting:
|
||||||
print(
|
print_once(
|
||||||
f"{Fore.YELLOW}Waiting for jobs to update status:",
|
f"{Fore.YELLOW}Waiting for jobs to update status:",
|
||||||
", ".join(jobs_waiting),
|
", ".join(jobs_waiting),
|
||||||
Fore.RESET,
|
Fore.RESET,
|
||||||
@@ -321,7 +320,9 @@ def cancel_jobs(
|
|||||||
with ThreadPoolExecutor(max_workers=6) as exe:
|
with ThreadPoolExecutor(max_workers=6) as exe:
|
||||||
part = partial(cancel_job, project)
|
part = partial(cancel_job, project)
|
||||||
exe.map(part, to_cancel)
|
exe.map(part, to_cancel)
|
||||||
print()
|
|
||||||
|
# The cancelled jobs are printed without a newline
|
||||||
|
print_once()
|
||||||
|
|
||||||
|
|
||||||
def print_log(
|
def print_log(
|
||||||
|
@@ -12,6 +12,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
from functools import cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
GITLAB_URL = "https://gitlab.freedesktop.org"
|
GITLAB_URL = "https://gitlab.freedesktop.org"
|
||||||
@@ -28,10 +29,16 @@ TOKEN_PREFIXES: dict[str, str] = {
|
|||||||
"Feed token": "glft-",
|
"Feed token": "glft-",
|
||||||
"Incoming mail token": "glimt-",
|
"Incoming mail token": "glimt-",
|
||||||
"GitLab Agent for Kubernetes token": "glagent-",
|
"GitLab Agent for Kubernetes token": "glagent-",
|
||||||
"SCIM Tokens": "glsoat-"
|
"SCIM Tokens": "glsoat-",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def print_once(*args, **kwargs):
|
||||||
|
"""Print without spamming the output"""
|
||||||
|
print(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def pretty_duration(seconds):
|
def pretty_duration(seconds):
|
||||||
"""Pretty print duration"""
|
"""Pretty print duration"""
|
||||||
hours, rem = divmod(seconds, 3600)
|
hours, rem = divmod(seconds, 3600)
|
||||||
|
Reference in New Issue
Block a user