diff options
author | Dominik Schmid <dominikschmid93@gmail.com> | 2019-03-17 00:26:20 +1100 |
---|---|---|
committer | Dominik Schmid <dominikschmid93@gmail.com> | 2019-03-17 00:28:11 +1100 |
commit | 552587730c1fb80f8fc42eb3f76423468f922d6c (patch) | |
tree | 0a91ad5ecaef770279a65660ad431228099b6c0b | |
parent | b794baaf68c456541681befb0bb670aa7d5d048e (diff) |
Return a result when setup fails.training-setup-resilience
This can happen when bots fail to import stuff.
-rw-r--r-- | src/main/python/rlbot/training/training.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main/python/rlbot/training/training.py b/src/main/python/rlbot/training/training.py index 564a1044..c165343f 100644 --- a/src/main/python/rlbot/training/training.py +++ b/src/main/python/rlbot/training/training.py @@ -35,7 +35,7 @@ class Fail: return 'FAIL' -class FailDueToExerciseException(Fail): +class FailDueToException(Fail): """ Indicates that the test code threw an expetion. """ def __init__(self, exception: Exception, traceback_string: str): @@ -43,8 +43,18 @@ class FailDueToExerciseException(Fail): self.traceback_string = traceback_string def __repr__(self): + return 'FAIL: Exception raised:\n' + self.traceback_string + +class FailDueToExerciseException(FailDueToException): + """ Indicates that the Exercise or Grader code threw an expetion. """ + def __repr__(self): return 'FAIL: Exception raised by Exercise:\n' + self.traceback_string +class FailDueToExceptionInMatchSetup(FailDueToException): + """ Indicates that the Exercise or Grader code threw an expetion. """ + def __repr__(self): + return 'FAIL: Exception raised while setting up the match:\n' + self.traceback_string + # Note: not using Grade as a abstract base class for Pass/Fail # as there should not be Grades which are neither Pass nor Fail. @@ -129,7 +139,13 @@ def run_exercises(setup_manager: SetupManager, exercises: Iterable[Exercise], se new_match_config = exercise.get_match_config() if new_match_config != setup_manager.match_config: update_row('match', ren.renderman.white) - _setup_match(new_match_config, setup_manager) + try: + _setup_match(new_match_config, setup_manager) + except Exception as e: + update_row('match', ren.renderman.red) + yield Result(exercise, seed, FailDueToExceptionInMatchSetup(e, traceback.format_exc())) + continue + update_row('bots', ren.renderman.white) _wait_until_bots_ready(setup_manager, new_match_config) |