bin/ci: crnm: Use frozen set for statuses

Let's be defensive and use `frozenset` from Python to avoid changing
global variables during the runtime (or any static part of code).

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30526>
This commit is contained in:
Guilherme Gallo
2024-08-05 19:04:10 -03:00
committed by Marge Bot
parent 24d64102fe
commit ae15b656ef

View File

@@ -60,8 +60,8 @@ STATUS_COLORS = {
"skipped": "", "skipped": "",
} }
COMPLETED_STATUSES = {"success", "failed"} COMPLETED_STATUSES = frozenset({"success", "failed"})
RUNNING_STATUSES = {"created", "pending", "running"} RUNNING_STATUSES = frozenset({"created", "pending", "running"})
def print_job_status( def print_job_status(
@@ -126,10 +126,12 @@ def monitor_pipeline(
target_id: int = -1 target_id: int = -1
name_field_pad: int = len(max(dependencies, key=len))+2 name_field_pad: int = len(max(dependencies, key=len))+2
# In a running pipeline, we can skip following job traces that are in these statuses. # In a running pipeline, we can skip following job traces that are in these statuses.
skip_follow_statuses = COMPLETED_STATUSES.copy() skip_follow_statuses: frozenset[str] = (
if not force_manual: COMPLETED_STATUSES
if force_manual
# If the target job is marked as manual and we don't force it to run, it will be skipped. # If the target job is marked as manual and we don't force it to run, it will be skipped.
skip_follow_statuses.add("manual") else frozenset({*COMPLETED_STATUSES, "manual"})
)
# Pre-populate the stress status counter for already completed target jobs. # Pre-populate the stress status counter for already completed target jobs.
if stress: if stress: