|
|
|
@ -57,10 +57,8 @@ async def get_target_reliability(
|
|
|
|
# oh_duration=duration
|
|
|
|
# oh_duration=duration
|
|
|
|
# )
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if duration != 17520:
|
|
|
|
if not simulation_id:
|
|
|
|
if not simulation_id:
|
|
|
|
if duration == 17520:
|
|
|
|
|
|
|
|
simulation_id = TR_RBD_ID
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
simulation = await run_rbd_simulation(
|
|
|
|
simulation = await run_rbd_simulation(
|
|
|
|
sim_hours=duration,
|
|
|
|
sim_hours=duration,
|
|
|
|
token=token
|
|
|
|
token=token
|
|
|
|
@ -68,6 +66,19 @@ async def get_target_reliability(
|
|
|
|
|
|
|
|
|
|
|
|
simulation_id = simulation.get("data")
|
|
|
|
simulation_id = simulation.get("data")
|
|
|
|
await wait_for_workflow(simulation_id=simulation_id)
|
|
|
|
await wait_for_workflow(simulation_id=simulation_id)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
temporal_client = await Client.connect(TEMPORAL_URL)
|
|
|
|
|
|
|
|
handle = temporal_client.get_workflow_handle(f"simulation-{simulation_id}")
|
|
|
|
|
|
|
|
desc = await handle.describe()
|
|
|
|
|
|
|
|
status_name = desc.status.name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if status_name in ["RUNNING", "CONTINUED_AS_NEW"]:
|
|
|
|
|
|
|
|
raise HTTPException(
|
|
|
|
|
|
|
|
status_code=status.HTTP_425_TOO_EARLY, # or 409 Conflict
|
|
|
|
|
|
|
|
detail="Simulation still running. Please wait.",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
simulation_id = TR_RBD_ID
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results = await get_simulation_results(
|
|
|
|
results = await get_simulation_results(
|
|
|
|
|