Coverage for scripts / live_release_validation / actions / schedulers.py: 100.00%
21 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-09-14 22:07 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-09-14 22:07 +0000
1"""schedulers: prove every enabled batch scheduler against a real workload."""
3from __future__ import annotations
5from typing import Any
7from ..checks.jobs import _run_api_transport_lifecycle
8from ..checks.schedulers import (
9 PROBED_SCHEDULERS,
10 effective_scheduler_enablement,
11)
12from ..models import RunContext
15def action_schedulers(ctx: RunContext) -> dict[str, Any]:
16 """Run one scheduling-proof Job per enabled scheduler and record evidence.
18 Volcano, YuniKorn: a Job whose pods name the scheduler completes only if
19 that scheduler bound them. Kueue: a queue-labeled Job stays webhook-
20 suspended until the deployed gco-default queue admits it. Slurm: a probe
21 Job submits a real batch job through slurmrestd and requires COMPLETED.
22 Disabled schedulers are recorded as skipped with the configuration source;
23 KEDA and KubeRay carry derived evidence (see the reasons in the result).
24 """
25 enablement = effective_scheduler_enablement(ctx)
26 results: dict[str, dict[str, Any]] = {}
27 for scheduler in PROBED_SCHEDULERS:
28 state = enablement[scheduler]
29 if not state["enabled"]:
30 results[scheduler] = {
31 "status": "skipped",
32 "reason": (
33 f"Disabled by {state['source']}; pass --optional-schedulers to "
34 "force-enable an off-by-default scheduler for the run"
35 ),
36 }
37 continue
38 lifecycle = _run_api_transport_lifecycle(
39 ctx,
40 manifest_filename=f"{scheduler}-smoke-job.yaml",
41 path=scheduler,
42 marker_prefix=scheduler.upper(),
43 )
44 results[scheduler] = {"status": "validated", "source": state["source"], **lifecycle}
46 results["keda"] = {
47 "status": "derived",
48 "reason": (
49 "KEDA is a mandatory platform chart; its ScaledJob scaling path is "
50 "exercised end to end by the sqs action (the queue processor scales "
51 "from zero to apply that action's Job) and its chart convergence by "
52 "the topology action"
53 ),
54 }
55 results["kuberay"] = {
56 "status": "chart-level",
57 "reason": (
58 "RayCluster is a custom resource outside the manifest gateway's kind "
59 "allowlist, so no transport can carry a Ray workload; operator and "
60 "chart convergence are proved by the topology action"
61 ),
62 }
64 evidence = {"enablement": enablement, "schedulers": results}
65 ctx.checkpoint.state["scheduler_validation"] = evidence
66 ctx.persist()
67 return evidence