# Buggy code
def reset(self, new_config, logger_creator=None):
    """Resets trial for use with new config.

    Subclasses should override reset_config() to actually
    reset actor behavior for the new config."""
    self.config = new_config

    self._result_logger.flush()
    self._result_logger.close()

    self._create_logger(new_config.copy(), logger_creator)

    stdout_file = new_config.pop(STDOUT_FILE, None)
    stderr_file = new_config.pop(STDERR_FILE, None)

    self._close_logfiles()
    self._open_logfiles(stdout_file, stderr_file)

    success = self.reset_config(new_config)
    if not success:
        return False

    # Reset attributes. Will be overwritten by `restore` if a checkpoint
    # is provided.
    self._iteration = 0
    self._time_total = 0.0
    self._timesteps_total = None
    self._episodes_total = None
    self._time_since_restore = 0.0
    self._timesteps_since_restore = 0
    self._iterations_since_restore = 0
    self._restored = False

    return True


# Traceback (ray.tune.error.TuneError)
2020-11-19 19:42:27,243 VINFO updater.py:460 -- `rsync`ed /root/ray_results/tune_mnist_pbt/DEFAULT_1d092_00006_6_layer_1_size=128,layer_2_size=64_2020-11-19_19-41-58/ (remote) to /root/ray_results/tune_mn
ist_pbt/DEFAULT_1d092_00006_6_layer_1_size=128,layer_2_size=64_2020-11-19_19-41-58/ (local)
2020-11-19 19:42:27,247 ERROR trial_runner.py:868 -- Trial DEFAULT_1d092_00006: Error handling checkpoint /root/ray_results/2020-11-19_19-42-24w11y5gdl/checkpoint_1/
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.7/site-packages/ray/tune/trial_runner.py", line 864, in _process_trial_save
trial.on_checkpoint(trial.saving_to)
File "/root/anaconda3/lib/python3.7/site-packages/ray/tune/trial.py", line 498, in on_checkpoint
self, checkpoint.value))
ray.tune.error.TuneError: Trial DEFAULT_1d092_00006: Checkpoint path /root/ray_results/2020-11-19_19-42-24w11y5gdl/checkpoint_1/ not found after successful sync down.
2020-11-19 19:42:27,250 WARNING util.py:140 -- The `process_trial_save` operation took 1.05049467086792 seconds to complete, which may be a performance bottleneck.

# Fixed code
def reset(self, new_config, logger_creator=None):
    """Resets trial for use with new config.

    Subclasses should override reset_config() to actually
    reset actor behavior for the new config."""
    self.config = new_config

    self._result_logger.flush()
    self._result_logger.close()

    if logger_creator:
        logger.debug("Logger reset.")
        self._create_logger(new_config.copy(), logger_creator)
    else:
        logger.debug(
            "Did not reset logger. Got: "
            f"trainable.reset(logger_creator={logger_creator})."
        )

    stdout_file = new_config.pop(STDOUT_FILE, None)
    stderr_file = new_config.pop(STDERR_FILE, None)

    self._close_logfiles()
    self._open_logfiles(stdout_file, stderr_file)

    success = self.reset_config(new_config)
    if not success:
        return False

    # Reset attributes. Will be overwritten by `restore` if a checkpoint
    # is provided.
    self._iteration = 0
    self._time_total = 0.0
    self._timesteps_total = None
    self._episodes_total = None
    self._time_since_restore = 0.0
    self._timesteps_since_restore = 0
    self._iterations_since_restore = 0
    self._restored = False

    return True