# Buggy code
def _setup_runner(self):
    self.status = Trial.RUNNING
    trainable_cls = get_registry().get(TRAINABLE_CLASS, self.trainable_name)
    cls = ray.remote(
        num_cpus=self.resources.driver_cpu_limit,
        num_gpus=self.resources.driver_gpu_limit,
    )(trainable_cls)
    if not self.result_logger:
        if not os.path.exists(self.local_dir):
            os.makedirs(self.local_dir)
        self.logdir = tempfile.mkdtemp(
            prefix="{}_{}".format(str(self)[:MAX_LEN_IDENTIFIER], date_str()),
            dir=self.local_dir,
        )
        self.result_logger = UnifiedLogger(self.config, self.logdir, self.upload_dir)
    remote_logdir = self.logdir

    def logger_creator(config):
        # Set the working dir in the remote process, for user file writes
        if not os.path.exists(remote_logdir):
            os.makedirs(remote_logdir)
        os.chdir(remote_logdir)
        return NoopLogger(config, remote_logdir)

    # Logging for trials is handled centrally by TrialRunner, so
    # configure the remote runner to use a noop-logger.
    self.runner = cls.remote(
        config=self.config, registry=get_registry(), logger_creator=logger_creator
    )


# Traceback (ImportError)
Traceback (most recent call last):
File "/home/ubuntu/ray/python/ray/worker.py", line 1694, in fetch_and_execute_function_to_run
function = pickle.loads(serialized_function)
File "/home/ubuntu/ray/python/ray/tune/registry.py", line 12, in <module>
from ray.tune.trainable import Trainable, wrap_function
File "/home/ubuntu/ray/python/ray/tune/__init__.py", line 6, in <module>
from ray.tune.tune import run_experiments
File "/home/ubuntu/ray/python/ray/tune/tune.py", line 8, in <module>
from ray.tune.hyperband import HyperBandScheduler
File "/home/ubuntu/ray/python/ray/tune/hyperband.py", line 8, in <module>
from ray.tune.trial_scheduler import FIFOScheduler, TrialScheduler
File "/home/ubuntu/ray/python/ray/tune/trial_scheduler.py", line 5, in <module>
from ray.tune.trial import Trial
File "/home/ubuntu/ray/python/ray/tune/trial.py", line 15, in <module>
from ray.tune.registry import _default_registry, get_registry, TRAINABLE_CLASS
ImportError: cannot import name '_default_registry'

# Fixed code
def _setup_runner(self):
    self.status = Trial.RUNNING
    trainable_cls = ray.tune.registry.get_registry().get(
        ray.tune.registry.TRAINABLE_CLASS, self.trainable_name
    )
    cls = ray.remote(
        num_cpus=self.resources.driver_cpu_limit,
        num_gpus=self.resources.driver_gpu_limit,
    )(trainable_cls)
    if not self.result_logger:
        if not os.path.exists(self.local_dir):
            os.makedirs(self.local_dir)
        self.logdir = tempfile.mkdtemp(
            prefix="{}_{}".format(str(self)[:MAX_LEN_IDENTIFIER], date_str()),
            dir=self.local_dir,
        )
        self.result_logger = UnifiedLogger(self.config, self.logdir, self.upload_dir)
    remote_logdir = self.logdir

    def logger_creator(config):
        # Set the working dir in the remote process, for user file writes
        if not os.path.exists(remote_logdir):
            os.makedirs(remote_logdir)
        os.chdir(remote_logdir)
        return NoopLogger(config, remote_logdir)

    # Logging for trials is handled centrally by TrialRunner, so
    # configure the remote runner to use a noop-logger.
    self.runner = cls.remote(
        config=self.config,
        registry=ray.tune.registry.get_registry(),
        logger_creator=logger_creator,
    )