better error handling
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m39s
Run linting on the backend code / Build (pull_request) Successful in 34s
Run testing on the backend code / Build (pull_request) Failing after 3m3s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m39s
Run linting on the backend code / Build (pull_request) Successful in 34s
Run testing on the backend code / Build (pull_request) Failing after 3m3s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s
This commit is contained in:
parent
d6f723bee1
commit
f64e60ddf6
@ -92,6 +92,9 @@ def new_trip(preferences: Preferences,
|
|||||||
preferences = preferences
|
preferences = preferences
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if len(landmarks) == 0 :
|
||||||
|
raise HTTPException(status_code=500, detail=f"No landmarks were found.")
|
||||||
|
|
||||||
# insert start and finish to the landmarks list
|
# insert start and finish to the landmarks list
|
||||||
landmarks_short.insert(0, start_landmark)
|
landmarks_short.insert(0, start_landmark)
|
||||||
landmarks_short.append(end_landmark)
|
landmarks_short.append(end_landmark)
|
||||||
@ -115,6 +118,9 @@ def new_trip(preferences: Preferences,
|
|||||||
refined_tour = refiner.refine_optimization(landmarks, base_tour,
|
refined_tour = refiner.refine_optimization(landmarks, base_tour,
|
||||||
preferences.max_time_minute,
|
preferences.max_time_minute,
|
||||||
preferences.detour_tolerance_minute)
|
preferences.detour_tolerance_minute)
|
||||||
|
except TimeoutError as te :
|
||||||
|
logger.error(f'Refiner failed : {str(te)} Using base tour.')
|
||||||
|
refined_tour = base_tour
|
||||||
except Exception as exc :
|
except Exception as exc :
|
||||||
raise HTTPException(status_code=500, detail=f"An unexpected error occurred: {str(exc)}") from exc
|
raise HTTPException(status_code=500, detail=f"An unexpected error occurred: {str(exc)}") from exc
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ class Optimizer:
|
|||||||
circles = self.is_connected(solution)
|
circles = self.is_connected(solution)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
timeout = 40
|
timeout = 15
|
||||||
while circles is not None :
|
while circles is not None :
|
||||||
i += 1
|
i += 1
|
||||||
if i == timeout :
|
if i == timeout :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user