Files
Aislo/common_util/common_util_calc_runner.py
T
eomsangdonandClaude Opus 5.5 3a64f9a812 feat(472-4 ② 횡단 짝 모으기): [저장] · [확정] 횡단 설계선 · 면적 · 소단 구간을 Node 입구 한 갈래로(C1 · C2 · C4 · X3 풀림)
- Router_Design enforce 셋 · 넓힘 뒤 설계 — 파이썬은 입력 조립만 · 측점 묶음을 Node 한 번(B06_Section_Engine_Design_Node · cross.design) · Node 못 부르면 파이썬 짝
- 소단 구간 셈을 화면 파일에서 common_util_berm_spans.ts 로 · 서버도 같은 TS(cross.berm_spans) · Persist 가 다시 내보냄
- 값: 고정 자료 기준값 0 차(면적 · 계획고 · 누가토량 −17,570.7) · 설계선 점 13 곳 1e-4 m(반올림 동점 · 브레인 승인) — 기준값 시험에 판정 더함
- 시험: compute_cross_design 갈아 끼우던 시험 다섯을 묶음 자리로(까닭: [저장] 다시 셈이 묶음으로 부름) · 소단 글 시험 자리 옮김
- 등록부 · 위키 계산 목록 · B06 지침 줄

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:21:42 +09:00

40 lines
1.5 KiB
Python

"""계산 등록부 파이썬 실행기(PLAN 472-3 3-B) — 등록부 id 를 받아 서버 Node 입구 하나를 부름.
등록부 = `A00_Common/design/logic/design_calc_registry.ts` · 입구 = `design_calc_node.ts`
(`build:design-calc`). 부름은 `common_util_node_bundle.run_bundle_json` 한 길 · 계산 없음.
`NODE_IDS` = 등록부에서 실행기가 `node:` 인 줄(같은지 시험 `test_472_3_calc_runner.py`).
입력 꼴 = 입구 머리(`detail` · `route_points` · `context` · `excavation`).
"""
from __future__ import annotations
from collections.abc import Sequence
from pathlib import Path
from typing import Any
from common_util.common_util_node_bundle import run_bundle_json
ROOT = Path(__file__).resolve().parents[1]
BUNDLE = ROOT / "config" / "design_calc_node" / "design_calc_node.js"
NPM_SCRIPT = "build:design-calc"
NODE_IDS = frozenset(
{
"structure.layouts",
"masshaul.cumulative",
"haul.plan",
"excavation.trench",
"corridor.mesh",
"cross.design",
"cross.berm_spans",
}
)
def run_calc(ids: Sequence[str], inputs: dict[str, Any]) -> dict[str, Any] | None:
"""id 들을 한 번에 돌려 `{id: 값}` · 묶음 실패는 None · Node 실행기 아닌 id 는 ValueError."""
unknown = [item for item in ids if item not in NODE_IDS]
if unknown:
raise ValueError(f"Node 실행기 아닌 id: {', '.join(unknown)}")
output = run_bundle_json(BUNDLE, NPM_SCRIPT, {"run": list(ids), "inputs": inputs})
return output.get("results") if isinstance(output, dict) else None