diff --git a/python/ray/tune/trial_runner.py b/python/ray/tune/trial_runner.py index 93eaf1068..3149cab13 100644 --- a/python/ray/tune/trial_runner.py +++ b/python/ray/tune/trial_runner.py @@ -405,15 +405,17 @@ class TrialRunner(object): trial.update_last_result( result, terminate=(decision == TrialScheduler.STOP)) + # Checkpoints to disk. This should be checked even if + # the scheduler decision is STOP or PAUSE. Note that + # PAUSE only checkpoints to memory and does not update + # the global checkpoint state. + self._checkpoint_trial_if_needed(trial) + if decision == TrialScheduler.CONTINUE: - self._checkpoint_trial_if_needed(trial) self.trial_executor.continue_training(trial) elif decision == TrialScheduler.PAUSE: self.trial_executor.pause_trial(trial) elif decision == TrialScheduler.STOP: - # Checkpoint before ending the trial - # if checkpoint_at_end experiment option is set to True - self._checkpoint_trial_if_needed(trial) self.trial_executor.export_trial_if_needed(trial) self.trial_executor.stop_trial(trial) else: