fix: return only completed optimization results per run

This commit is contained in:
Andreas
2026-09-17 13:53:10 +02:00
committed by Andreas
parent 1e0579f6b6
commit cfa245b41a
3 changed files with 343 additions and 29 deletions
+1 -2
View File
@@ -2197,7 +2197,7 @@ async def fastapi_optimize(
start_datetime = to_datetime().set(hour=start_hour)
# Ensure there is only one optimization/ energy management run at a time
await get_ems().run(
solution = await get_ems().run(
start_datetime=start_datetime,
mode=EnergyManagementMode.OPTIMIZATION,
algorithm=OptimizationAlgorithm.GENETIC0,
@@ -2205,7 +2205,6 @@ async def fastapi_optimize(
genetic0_generations=ngen,
)
solution = get_ems().genetic0_solution()
if solution is None:
raise EOSProblem(
status=404,