fix: index production task artifacts
This commit is contained in:
parent
a811f621d9
commit
497f36d579
@ -2815,10 +2815,16 @@ def _find_scene_json(package_dir: Path) -> Path | None:
|
||||
|
||||
|
||||
def _index_artifacts(store: PlatformStore, task_id: str, root: Path) -> None:
|
||||
indexable_suffixes = {
|
||||
".json", ".jsonl", ".html", ".svg", ".png", ".jpg", ".jpeg", ".mp4", ".zip", ".tar", ".gz",
|
||||
".ply", ".spz", ".splat", ".ksplat", ".sog", ".rad", ".obj", ".glb", ".gltf", ".xml",
|
||||
".hdf5", ".h5", ".ckpt", ".pkl", ".npy", ".npz", ".csv", ".yaml", ".yml", ".toml", ".py",
|
||||
".log", ".txt",
|
||||
}
|
||||
for path in sorted(root.rglob("*")):
|
||||
if not path.is_file():
|
||||
continue
|
||||
if path.suffix.lower() in {".json", ".jsonl", ".html", ".svg", ".png", ".jpg", ".jpeg", ".mp4", ".zip", ".tar", ".gz", ".ply", ".xml", ".log", ".txt"}:
|
||||
if path.suffix.lower() in indexable_suffixes:
|
||||
store.add_artifact(task_id=task_id, name=path.name, path=path, kind=path.suffix.lower().lstrip(".") or "file")
|
||||
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from real2sim_platform.config import PlatformConfig
|
||||
from real2sim_platform.adapters import index_artifacts_for_task
|
||||
from real2sim_platform.rm65_controller import collect
|
||||
from real2sim_platform.server import create_app
|
||||
from real2sim_platform.storage import BosStorage, StorageBoundaryError, normalize_relative_path
|
||||
@ -241,6 +242,18 @@ def test_runtime_required_validation_steps_mujoco_and_motrixsim(tmp_path: Path)
|
||||
assert simulators["motrixsim"]["runtime"]["steps"] == 8
|
||||
|
||||
|
||||
def test_production_artifact_index_includes_viewer_dataset_and_model_outputs(tmp_path: Path) -> None:
|
||||
store = PlatformStore(tmp_path / "state.db")
|
||||
run_dir = tmp_path / "run"
|
||||
run_dir.mkdir()
|
||||
task = store.create_task(task_type="training", params={}, run_dir=run_dir)
|
||||
for filename in ("scene.glb", "episode_0.hdf5", "policy_best.ckpt", "dataset_stats.pkl"):
|
||||
(run_dir / filename).write_bytes(b"real-production-artifact")
|
||||
index_artifacts_for_task(store, task["id"], run_dir)
|
||||
names = {item["name"] for item in store.list_task_artifacts(task["id"])}
|
||||
assert names == {"scene.glb", "episode_0.hdf5", "policy_best.ckpt", "dataset_stats.pkl"}
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
def test_real_rm65_physical_collection_writes_act_hdf5(tmp_path: Path) -> None:
|
||||
scene = ROOT / "workspace/motrixsim_assets/parlour_rm65_pick_place/simulator_assets/rm65_table_pick_place.xml"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user