ci: run_n_monitor, sort by name when listing jobs

The job loops, w/o and explicit sort, are sorted by the job id. As they produce
logs, humans could feel an improvement by sorting by name.

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29444>
This commit is contained in:
Sergi Blanch Torne
2024-06-13 14:32:23 +02:00
committed by Marge Bot
parent 12c1bdc31d
commit 5873b3ac14
2 changed files with 4 additions and 6 deletions

View File

@@ -136,7 +136,7 @@ def monitor_pipeline(
while True:
deps_failed = []
to_cancel = []
for job in pipeline.jobs.list(all=True, sort="desc"):
for job in sorted(pipeline.jobs.list(all=True), key=lambda j: j.name):
# target jobs
if target_jobs_regex.fullmatch(job.name):
target_id = job.id
@@ -175,7 +175,7 @@ def monitor_pipeline(
if stress:
enough = True
for job_name, status in stress_status_counter.items():
for job_name, status in sorted(stress_status_counter.items()):
print(
f"* {job_name:{name_field_pad}}succ: {status['success']}; "
f"fail: {status['failed']}; "

View File

@@ -331,10 +331,8 @@ def filter_dag(dag: Dag, regex: Pattern) -> Dag:
def print_dag(dag: Dag) -> None:
for job, data in dag.items():
print(f"{job}:")
print(f"\t{' '.join(data['needs'])}")
print()
for job, data in sorted(dag.items()):
print(f"{job}:\n\t{' '.join(data['needs'])}\n")
def fetch_merged_yaml(gl_gql: GitlabGQL, params) -> dict[str, Any]: