feat(simulation): integrate infrastructure jobs and semantic scene editing
Integrate infrastructure preparation and qualified map delivery with local scenes. Add semantic editing, object provenance, survey caching and operator scene tools.
This commit is contained in:
@@ -5,6 +5,8 @@ import ast
|
||||
import hashlib
|
||||
import json
|
||||
import tarfile
|
||||
import runpy
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(__file__).resolve().parents[2]
|
||||
@@ -14,10 +16,30 @@ args = parser.parse_args()
|
||||
args.output.mkdir(parents=True, exist_ok=True)
|
||||
files = sorted(
|
||||
p
|
||||
for folder in (root / "src", root / "simulation/ai-polygon")
|
||||
for folder in (root / "src", root / "simulation/ai-polygon", root / "simulation/urban-mapping")
|
||||
for p in folder.rglob("*")
|
||||
if p.is_file() and not p.is_symlink() and "__pycache__" not in p.parts
|
||||
if p.is_file() and not p.is_symlink() and "__pycache__" not in p.parts and ".build" not in p.parts
|
||||
)
|
||||
# Only the declared Gaussian pipeline closure ships; historical review scripts
|
||||
# and private qualification directories are not part of the worker artifact.
|
||||
from infrastructure_pipeline import definition_files
|
||||
module = root / "simulation/urban-plan-research"
|
||||
_, urban_files = definition_files(module)
|
||||
files.extend(module / relative for relative in urban_files)
|
||||
# Pinned runtime wheels are artifact assets, never a global pip installation.
|
||||
pins = runpy.run_path(str(module / "catalog_pass/catalog_dependency_pins.py"))["PINS"]
|
||||
cache = args.output / "urban-dependencies"
|
||||
cache.mkdir(exist_ok=True)
|
||||
assets = {}
|
||||
for pin in pins:
|
||||
path = cache / pin["file"]
|
||||
if not path.exists() or hashlib.sha256(path.read_bytes()).hexdigest() != pin["sha256"]:
|
||||
with urllib.request.urlopen(pin["url"], timeout=120) as response:
|
||||
raw = response.read(32 * 1024**2 + 1)
|
||||
if len(raw) > 32 * 1024**2 or hashlib.sha256(raw).hexdigest() != pin["sha256"]:
|
||||
raise ValueError("Pinned urban runtime dependency changed")
|
||||
path.write_bytes(raw)
|
||||
assets["simulation/urban-plan-research/pipeline/vendor/" + pin["file"]] = path
|
||||
files.extend((root / "apps/control-station/public/vendor/playcanvas/draco/1.5.7").glob("*"))
|
||||
# The canonical Rover 006 asset is shared with PlayCanvas, not a second model.
|
||||
for profile in (root / "simulation/ai-polygon/robots").glob("*.json"):
|
||||
@@ -32,12 +54,15 @@ for source in files:
|
||||
manifest = {
|
||||
p.relative_to(root).as_posix(): hashlib.sha256(p.read_bytes()).hexdigest() for p in files
|
||||
}
|
||||
manifest.update({name: hashlib.sha256(p.read_bytes()).hexdigest() for name, p in assets.items()})
|
||||
encoded = json.dumps(manifest, sort_keys=True, indent=2).encode()
|
||||
identity = hashlib.sha256(encoded).hexdigest()
|
||||
path = args.output / ("ai-polygon-" + identity[:16] + ".tgz")
|
||||
with tarfile.open(path, "w:gz") as archive:
|
||||
for p in files:
|
||||
archive.add(p, arcname=p.relative_to(root).as_posix(), recursive=False)
|
||||
for name, asset in assets.items():
|
||||
archive.add(asset, arcname=name, recursive=False)
|
||||
manifest_path = path.with_suffix(".manifest.json")
|
||||
manifest_path.write_bytes(encoded)
|
||||
print(
|
||||
|
||||
Reference in New Issue
Block a user