ci: continue stress run'n'monitor

When the tool is used to stress test a pipeline, if there are jobs already ran,
use their information like it does when the stress flag is not set.

This provides consistency between the behavior when stress argument is not set,
to when it is set. When it is not set, it uses the information about jobs that
are already done. When it is set, it has to use the information about the
already ran jobs. Also, it saves resources by triggering the minimum required.

Signed-off-by: Sergi Blanch Torne <sergi.blanch.torne@collabora.com>
Reviewed-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29432>
This commit is contained in:
Sergi Blanch Torne
2024-05-28 14:48:05 +02:00
parent 51d1e005e8
commit 2d6e72c2cb

View File

@@ -107,6 +107,13 @@ def monitor_pipeline(
stress_status_counter = defaultdict(lambda: defaultdict(int))
target_id = None
# Pre-populate the stress status counter for already completed target jobs.
if stress:
# When stress test, it is necessary to collect this information before start.
for job in pipeline.jobs.list(all=True, include_retried=True):
if target_jobs_regex.fullmatch(job.name) and job.status in ["success", "failed"]:
stress_status_counter[job.name][job.status] += 1
while True:
deps_failed = []
to_cancel = []
@@ -309,7 +316,9 @@ def parse_args() -> None:
"--stress",
default=0,
type=int,
help="Stresstest job(s). Number or repetitions or -1 for infinite.",
help="Stresstest job(s). Specify the number of times to rerun the selected jobs, "
"or use -1 for indefinite. Defaults to 0. If jobs have already been executed, "
"this will ensure the total run count respects the specified number.",
)
parser.add_argument(
"--project",