Add dataset bench and validation agents
This commit is contained in:
35
scripts/run_agents.py
Normal file
35
scripts/run_agents.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "backend"))
|
||||
|
||||
from app.agents.evaluation_agent import evaluate_project # noqa: E402
|
||||
from app.agents.validation_agent import validate_project # noqa: E402
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Run local evaluation and validation agents.")
|
||||
parser.add_argument("--build", action="store_true", help="also run pytest and frontend build")
|
||||
parser.add_argument("--out", default="var/agent_reports/latest.json")
|
||||
args = parser.parse_args()
|
||||
report = {
|
||||
"evaluation": evaluate_project(),
|
||||
"validation": validate_project(run_build=args.build),
|
||||
}
|
||||
out = ROOT / args.out
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
out.write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
if not report["validation"]["passed"]:
|
||||
raise SystemExit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
BACKEND_ENV="${SEG_BACKEND_CONDA_ENV:-seg_server}"
|
||||
BACKEND_ENV="${SEG_BACKEND_CONDA_ENV:-seg_smp}"
|
||||
HOST="${SEG_BACKEND_HOST:-0.0.0.0}"
|
||||
PORT="${SEG_BACKEND_PORT:-8000}"
|
||||
PORT="${SEG_BACKEND_PORT:-8010}"
|
||||
|
||||
cd "${ROOT_DIR}"
|
||||
exec conda run -n "${BACKEND_ENV}" uvicorn app.main:app --app-dir backend --host "${HOST}" --port "${PORT}" --reload
|
||||
|
||||
|
||||
Reference in New Issue
Block a user