Skip to content

Commit

Permalink
Remove statscollector from GameError
Browse files Browse the repository at this point in the history
  • Loading branch information
Parzival-05 committed Aug 30, 2024
1 parent 0ca57e6 commit 3407414
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions AIAgent/ml/game/errors_game.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from ml.training.epochs_statistics import StatisticsCollector
from connection.errors_connection import GameInterruptedError
from common.utils import inheritors
from common.game import GameMap2SVM
Expand All @@ -16,8 +15,6 @@ def __init__(

super().__init__(game_map2svm, error_name)

def handle_error(self, statistics_collector: StatisticsCollector):
def need_to_save_map(self):
gie_inheritors = inheritors(GameInterruptedError)
if self._error_name in map(lambda it: it.__name__, gie_inheritors):
return
statistics_collector.fail(self._map)
return self._error_name not in map(lambda it: it.__name__, gie_inheritors)
4 changes: 3 additions & 1 deletion AIAgent/ml/training/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def validate_coverage(
colour=progress_bar_colour,
):
if isinstance(result, GameError):
result.handle_error(statistics_collector)
need_to_save_map: bool = result.need_to_save_map()
if not need_to_save_map:
statistics_collector.fail(result._map)
else:
all_results.append(result)

Expand Down

0 comments on commit 3407414

Please sign in to comment.