feat: initial HSAP platform
Huaxu Sentinel Active Safety Platform with embedded algorithm code, Docker Compose setup, and vendored dataset scaffolds for clone-and-run. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
0
platform/as_platform/agents/graphs/__init__.py
Normal file
0
platform/as_platform/agents/graphs/__init__.py
Normal file
30
platform/as_platform/agents/graphs/ingest_flow.py
Normal file
30
platform/as_platform/agents/graphs/ingest_flow.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""ingest_flow:感知 returned 批次 → 提交 build 审核。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from as_platform.agents.tools import invoke_tool, submit_build_for_batch
|
||||
from as_platform.agents.trace import start_trace, trace_span
|
||||
|
||||
|
||||
def run_ingest_flow(*, task: str = "dam", submitted_by: str = "agent") -> dict[str, Any]:
|
||||
trace_id = start_trace("ingest_flow", task=task)
|
||||
with trace_span("list_pending"):
|
||||
report = invoke_tool("list_pending_batches")
|
||||
|
||||
submitted = []
|
||||
for batch in report.get("batches", []):
|
||||
if batch.get("task") != task:
|
||||
continue
|
||||
if batch.get("stage") != "returned":
|
||||
continue
|
||||
with trace_span("submit_build", batch=batch.get("batch")):
|
||||
apr = submit_build_for_batch(
|
||||
task=task,
|
||||
batch=batch["batch"],
|
||||
pack=batch.get("pack") or "dms_v2",
|
||||
submitted_by=submitted_by,
|
||||
)
|
||||
submitted.append(apr)
|
||||
|
||||
return {"trace_id": trace_id, "submitted": submitted, "count": len(submitted)}
|
||||
20
platform/as_platform/agents/graphs/labeling_flow.py
Normal file
20
platform/as_platform/agents/graphs/labeling_flow.py
Normal file
@@ -0,0 +1,20 @@
|
||||
"""labeling_flow:列出 raw_pool / out_for_labeling 批次。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from as_platform.agents.tools import invoke_tool
|
||||
from as_platform.agents.trace import start_trace, trace_span
|
||||
|
||||
|
||||
def run_labeling_flow(*, task: str | None = None) -> dict[str, Any]:
|
||||
trace_id = start_trace("labeling_flow", task=task)
|
||||
with trace_span("list_pending"):
|
||||
report = invoke_tool("list_pending_batches")
|
||||
|
||||
batches = [
|
||||
b for b in report.get("batches", [])
|
||||
if b.get("stage") in ("raw_pool", "out_for_labeling", "returned")
|
||||
and (task is None or b.get("task") == task)
|
||||
]
|
||||
return {"trace_id": trace_id, "batches": batches, "count": len(batches)}
|
||||
18
platform/as_platform/agents/graphs/train_promote_flow.py
Normal file
18
platform/as_platform/agents/graphs/train_promote_flow.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""train_promote_flow:提交 train 审核(platform 轨)。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from as_platform.agents.tools import get_model_versions, invoke_tool, submit_train_job
|
||||
from as_platform.agents.trace import start_trace, trace_span
|
||||
|
||||
|
||||
def run_train_promote_flow(*, task: str = "dam", submitted_by: str = "agent") -> dict[str, Any]:
|
||||
trace_id = start_trace("train_promote_flow", task=task)
|
||||
with trace_span("get_versions"):
|
||||
versions = get_model_versions(task)
|
||||
|
||||
with trace_span("submit_train"):
|
||||
apr = submit_train_job("dms", task, track="platform", submitted_by=submitted_by)
|
||||
|
||||
return {"trace_id": trace_id, "versions_before": versions, "approval": apr}
|
||||
Reference in New Issue
Block a user