Tighten agent validation gates
This commit is contained in:
@@ -47,6 +47,7 @@ def validate_project(
|
||||
run_acceptance: bool | None = None,
|
||||
run_deep: bool | None = None,
|
||||
run_real: bool | None = None,
|
||||
run_live: bool | None = None,
|
||||
) -> dict:
|
||||
"""Validate current runtime readiness without launching heavy training."""
|
||||
checks = []
|
||||
@@ -67,7 +68,14 @@ def validate_project(
|
||||
checks.append({"name": "training_curves_detected", "passed": len(curves) >= 1, "detail": {"count": len(curves), "examples": [item["relative_path"] for item in curves[:5]]}})
|
||||
parsed_progress = parse_progress("Epoch(train) [2][25/50] lr: 1e-3\n", status="running")
|
||||
checks.append({"name": "job_progress_parser", "passed": parsed_progress["stage"] == "training" and parsed_progress["percent"] == 50, "detail": parsed_progress})
|
||||
checks.append({"name": "gpus_query", "passed": bool(get_gpus().get("available"))})
|
||||
gpus = get_gpus()
|
||||
checks.append(
|
||||
{
|
||||
"name": "gpus_query",
|
||||
"passed": "available" in gpus and isinstance(gpus.get("gpus"), list),
|
||||
"detail": gpus,
|
||||
}
|
||||
)
|
||||
env_names = [item["name"] for item in get_conda_envs().get("envs", [])]
|
||||
checks.append({"name": "task_env_exists", "passed": settings.task_conda_env in env_names, "detail": {"env": settings.task_conda_env}})
|
||||
checks.append({"name": "mmseg_env_exists", "passed": settings.mmseg_conda_env in env_names, "detail": {"env": settings.mmseg_conda_env}})
|
||||
@@ -111,7 +119,13 @@ def validate_project(
|
||||
no_weight = _run(["bash", "scripts/check_no_weight_git.sh"], cwd=settings.project_root)
|
||||
checks.append({"name": "no_weight_in_git", "passed": no_weight["passed"], "detail": no_weight})
|
||||
|
||||
if os.getenv("SEG_VALIDATE_LIVE", "1") == "1":
|
||||
acceptance_enabled = run_acceptance if run_acceptance is not None else os.getenv("SEG_VALIDATE_ACCEPTANCE", "0") == "1"
|
||||
deep_enabled = run_deep if run_deep is not None else os.getenv("SEG_VALIDATE_DEEP", "1") == "1"
|
||||
real_enabled = run_real if run_real is not None else os.getenv("SEG_VALIDATE_REAL", "0") == "1"
|
||||
live_enabled = run_live if run_live is not None else os.getenv("SEG_VALIDATE_LIVE", "0") == "1"
|
||||
live_enabled = live_enabled or acceptance_enabled or real_enabled
|
||||
|
||||
if live_enabled:
|
||||
backend_url = os.getenv("SEG_VALIDATE_BACKEND_URL", "http://127.0.0.1:8010")
|
||||
frontend_url = os.getenv("SEG_VALIDATE_FRONTEND_URL", "http://127.0.0.1:5173")
|
||||
health = _fetch(f"{backend_url}/api/health")
|
||||
@@ -146,9 +160,6 @@ def validate_project(
|
||||
checks.append({"name": "live_coverage_api", "passed": live_coverage["passed"] and '"task_build_passed":true' in live_coverage.get("body", "").replace(" ", ""), "detail": live_coverage})
|
||||
checks.append({"name": "live_training_curves_api", "passed": live_curves["passed"] and live_curves.get("body", "").lstrip().startswith("["), "detail": live_curves})
|
||||
checks.append({"name": "live_frontend_index", "passed": frontend["passed"] and "Seg Data Server" in frontend.get("body", ""), "detail": frontend})
|
||||
acceptance_enabled = run_acceptance if run_acceptance is not None else os.getenv("SEG_VALIDATE_ACCEPTANCE", "1") == "1"
|
||||
deep_enabled = run_deep if run_deep is not None else os.getenv("SEG_VALIDATE_DEEP", "1") == "1"
|
||||
real_enabled = run_real if run_real is not None else os.getenv("SEG_VALIDATE_REAL", "0") == "1"
|
||||
if acceptance_enabled:
|
||||
acceptance = run_live_acceptance(backend_url)
|
||||
checks.append({"name": "live_acceptance_smoke", "passed": acceptance["passed"], "detail": acceptance})
|
||||
@@ -158,6 +169,9 @@ def validate_project(
|
||||
if deep_enabled:
|
||||
deep_acceptance = run_deep_acceptance()
|
||||
checks.append({"name": "deep_training_acceptance", "passed": deep_acceptance["passed"], "detail": deep_acceptance})
|
||||
elif deep_enabled:
|
||||
deep_acceptance = run_deep_acceptance()
|
||||
checks.append({"name": "deep_training_acceptance", "passed": deep_acceptance["passed"], "detail": deep_acceptance})
|
||||
|
||||
if run_build:
|
||||
tests = _run(["conda", "run", "-n", settings.backend_conda_env, "python", "-m", "pytest", "-q"], cwd=settings.project_root, timeout=120)
|
||||
|
||||
Reference in New Issue
Block a user