Add API runsimulationbydate
This commit is contained in:
18
main.py
18
main.py
@@ -2725,6 +2725,24 @@ async def fastapi_run_project(network: str,start_time:str,end_time=None) -> str:
|
||||
#os.rename(filename2, filename)
|
||||
return result
|
||||
|
||||
@app.get("/runsimulationbydate/", response_class = PlainTextResponse)
|
||||
async def fastapi_run_project_by_date(network: str, querydate: str) -> str:
|
||||
filename = 'c:/lock.simulation'
|
||||
filename2 = 'c:/lock.simulation2'
|
||||
if os.path.exists(filename2):
|
||||
print('file exists')
|
||||
raise HTTPException(status_code=409, detail="is in simulation")
|
||||
else:
|
||||
print('file doesnt exists')
|
||||
#os.rename(filename, filename2)
|
||||
|
||||
bg_start_time, bg_end_time = time_api.parse_beijing_date_range(querydate)
|
||||
|
||||
result = run_simulation_ex(name=network, simulation_type='realtime', start_datetime=bg_start_time, end_datetime=bg_end_time)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
# real_time api 37.5
|
||||
# example:
|
||||
|
||||
Reference in New Issue
Block a user