Files
NODEDC_MISSION_CORE/simulation/urban-plan-research/multiview/mv_io.py
T
DCCONSTRUCTIONS 69dc566665 feat(research): preserve urban geometry pipelines and qualification suites
Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
2026-10-29 09:10:00 +03:00

43 lines
1.0 KiB
Python

"""Artifact-scoped I/O for the offline qualification only."""
from pathlib import Path
import json, os, hashlib, shutil
RUN = Path('/run')
ORTHO = Path('/ortho')
SURVEY = ORTHO / 'survey'
SCENE = os.environ.get('ORTHO_SCENE', '')
MODEL = os.environ.get('MV_MODEL', 'mapillary')
def read(path):
return json.loads(Path(path).read_text())
def write(path, value):
path = Path(path)
path.parent.mkdir(parents=True, exist_ok=True)
temporary = path.with_suffix(path.suffix + '.tmp')
temporary.write_text(json.dumps(value, indent=2, allow_nan=False))
temporary.replace(path)
def digest(path):
h = hashlib.sha256()
with Path(path).open('rb') as stream:
for block in iter(lambda: stream.read(1024 * 1024), b''):
h.update(block)
return h.hexdigest()
def guard():
if shutil.disk_usage(RUN).free < 8 * 2**30:
raise RuntimeError('Qualification free-disk floor reached')
def record(message):
print(json.dumps(message, allow_nan=False), flush=True)
def config():
return read(RUN / 'config.json')