ci/ci_run_n_monitor: limit repetitions on --stress
--stress options now receives the number of repetitions or -1 to behave as before. Signed-off-by: Helen Koike <helen.koike@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25473>
This commit is contained in:
@@ -79,7 +79,7 @@ def monitor_pipeline(
|
|||||||
target_job: str,
|
target_job: str,
|
||||||
dependencies,
|
dependencies,
|
||||||
force_manual: bool,
|
force_manual: bool,
|
||||||
stress: bool,
|
stress: int,
|
||||||
) -> tuple[Optional[int], Optional[int]]:
|
) -> tuple[Optional[int], Optional[int]]:
|
||||||
"""Monitors pipeline and delegate canceling jobs"""
|
"""Monitors pipeline and delegate canceling jobs"""
|
||||||
statuses: dict[str, str] = defaultdict(str)
|
statuses: dict[str, str] = defaultdict(str)
|
||||||
@@ -97,8 +97,12 @@ def monitor_pipeline(
|
|||||||
target_id = job.id
|
target_id = job.id
|
||||||
|
|
||||||
if stress and job.status in ["success", "failed"]:
|
if stress and job.status in ["success", "failed"]:
|
||||||
stress_status_counter[job.name][job.status] += 1
|
if (
|
||||||
enable_job(project, job, "retry", force_manual)
|
stress < 0
|
||||||
|
or sum(stress_status_counter[job.name].values()) < stress
|
||||||
|
):
|
||||||
|
enable_job(project, job, "retry", force_manual)
|
||||||
|
stress_status_counter[job.name][job.status] += 1
|
||||||
else:
|
else:
|
||||||
enable_job(project, job, "target", force_manual)
|
enable_job(project, job, "target", force_manual)
|
||||||
|
|
||||||
@@ -120,15 +124,20 @@ def monitor_pipeline(
|
|||||||
cancel_jobs(project, to_cancel)
|
cancel_jobs(project, to_cancel)
|
||||||
|
|
||||||
if stress:
|
if stress:
|
||||||
|
enough = True
|
||||||
for job_name, status in stress_status_counter.items():
|
for job_name, status in stress_status_counter.items():
|
||||||
print(
|
print(
|
||||||
f"{job_name}\tsucc: {status['success']}; "
|
f"{job_name}\tsucc: {status['success']}; "
|
||||||
f"fail: {status['failed']}; "
|
f"fail: {status['failed']}; "
|
||||||
f"total: {sum(status.values())}",
|
f"total: {sum(status.values())} of {stress}",
|
||||||
flush=False,
|
flush=False,
|
||||||
)
|
)
|
||||||
pretty_wait(REFRESH_WAIT_JOBS)
|
if stress < 0 or sum(status.values()) < stress:
|
||||||
continue
|
enough = False
|
||||||
|
|
||||||
|
if not enough:
|
||||||
|
pretty_wait(REFRESH_WAIT_JOBS)
|
||||||
|
continue
|
||||||
|
|
||||||
print("---------------------------------", flush=False)
|
print("---------------------------------", flush=False)
|
||||||
|
|
||||||
@@ -239,7 +248,12 @@ def parse_args() -> None:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--force-manual", action="store_true", help="Force jobs marked as manual"
|
"--force-manual", action="store_true", help="Force jobs marked as manual"
|
||||||
)
|
)
|
||||||
parser.add_argument("--stress", action="store_true", help="Stresstest job(s)")
|
parser.add_argument(
|
||||||
|
"--stress",
|
||||||
|
default=0,
|
||||||
|
type=int,
|
||||||
|
help="Stresstest job(s). Number or repetitions or -1 for infinite.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--project",
|
"--project",
|
||||||
default="mesa",
|
default="mesa",
|
||||||
|
Reference in New Issue
Block a user