Refine
This commit is contained in:
3
main.py
3
main.py
@@ -155,13 +155,14 @@ async def fastapi_dump_inp(network: str, inp: str) -> bool:
|
|||||||
async def fastapi_run_project(network: str) -> str:
|
async def fastapi_run_project(network: str) -> str:
|
||||||
global lock_simulation
|
global lock_simulation
|
||||||
|
|
||||||
if lock_simulation.locked:
|
if lock_simulation.value == 1:
|
||||||
raise HTTPException(status_code=409, detail="is in simulation")
|
raise HTTPException(status_code=409, detail="is in simulation")
|
||||||
|
|
||||||
with lock_simulation.get_lock():
|
with lock_simulation.get_lock():
|
||||||
print('lock simulation')
|
print('lock simulation')
|
||||||
lock_simulation.value = 1
|
lock_simulation.value = 1
|
||||||
result = run_project(network)
|
result = run_project(network)
|
||||||
|
lock_simulation.value = 0
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# put in inp folder, name without extension
|
# put in inp folder, name without extension
|
||||||
|
|||||||
Reference in New Issue
Block a user