现有组件功能与Amesim组件比较对齐,补全功能;仿真服务启动环境检测,旧版json工程文件适配读取
This commit is contained in:
1 parent
b6c22a54f8
commit
6fc9afe41d
119 files changed
+260114
-351
No files matched your search
+15
-3
@@ -46,14 +46,19 @@ async def _app_lifespan(application: FastAPI) -> AsyncIterator[None]:
|
||||
import logging
|
||||
|
||||
from app.simulation.backends import numeric_engine_name
|
||||
from app.simulation.warmup import warm_up_simulation_runtime
|
||||
from app.simulation.warmup import SimulationRuntimeCheck
|
||||
|
||||
application.state.simulation_numeric_engine = numeric_engine_name()
|
||||
logging.getLogger("uvicorn.error").info(
|
||||
"Simulation numeric engine: %s", application.state.simulation_numeric_engine,
|
||||
)
|
||||
application.state.simulation_warmup = warm_up_simulation_runtime().as_dict()
|
||||
yield
|
||||
runtime_check = SimulationRuntimeCheck()
|
||||
application.state.simulation_runtime_check = runtime_check
|
||||
runtime_check.start()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
runtime_check.close()
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
@@ -338,6 +343,13 @@ def get_component_catalog() -> dict[str, object]:
|
||||
return build_component_catalog()
|
||||
|
||||
|
||||
@app.get("/api/simulation/runtime-check")
|
||||
def get_simulation_runtime_check(request: Request) -> Response:
|
||||
report = request.app.state.simulation_runtime_check.snapshot()
|
||||
return Response(content=json.dumps(report, ensure_ascii=False), media_type="application/json",
|
||||
headers={"Cache-Control": "no-store"})
|
||||
|
||||
|
||||
@app.post("/api/reactflow/system-xml")
|
||||
def export_reactflow_system_xml(payload: ReactFlowProjectPayload) -> Response:
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user