diff --git a/AIAgent/ml/play_game.py b/AIAgent/ml/play_game.py index 45c2088..1c53e0c 100644 --- a/AIAgent/ml/play_game.py +++ b/AIAgent/ml/play_game.py @@ -163,14 +163,13 @@ def play_game( f"actual coverage: {game_result.actual_coverage_percent:.2f}" ) map2result = Map2Result(game_map2svm, game_result) - except (FunctionTimedOut, Exception) as error: - if isinstance(error, FunctionTimedOut): - log_message = f"<{with_predictor.name()}> timeouted on map {game_map2svm.GameMap.MapName} with {error.timedOutAfter}s" - else: - log_message = f"<{with_predictor.name()}> failed on map {game_map2svm.GameMap.MapName}:\n{traceback.format_exc()}" - logging.warning(log_message) - FeatureConfig.SAVE_IF_FAIL_OR_TIMEOUT.save_model( - with_predictor.model(), with_name=f"{with_predictor.name()}" - ) - map2result = Map2Result(game_map2svm, None) + except FunctionTimedOut as error: + log_message = f"<{with_predictor.name()}> timeouted on map {game_map2svm.GameMap.MapName} with {error.timedOutAfter}s" + except Exception: + log_message = f"<{with_predictor.name()}> failed on map {game_map2svm.GameMap.MapName}:\n{traceback.format_exc()}" + logging.warning(log_message) + FeatureConfig.SAVE_IF_FAIL_OR_TIMEOUT.save_model( + with_predictor.model(), with_name=f"{with_predictor.name()}" + ) + map2result = Map2Result(game_map2svm, None) return map2result