def run_example_debug(example_module_name, example_argv):
    """The debug mode limits tune trial runs to enable use of debugger.

    The debug mode should allow easy switch between parallelized and
    non-parallelized runs such that the debugger can be reasonably used when
    running the code. In practice, this allocates all the cpus available in ray
    such that only a single trial can run at once.

    TODO(hartikainen): This should allocate a custom "debug_resource" instead
    of all cpus once ray local mode supports custom resources.
    """

    debug_example_argv = []
    for option in example_argv:
        if '--trial-cpus' in option:
            available_cpus = multiprocessing.cpu_count()
            debug_example_argv.append(f'--trial-cpus={available_cpus}')
        elif '--upload-dir' in option:
            print(f"Ignoring {option} due to debug mode.")
            continue
        else:
            debug_example_argv.append(option)

    run_example_local(example_module_name, debug_example_argv, local_mode=True)
The debug mode limits tune trial runs to enable use of debugger.

The debug mode should allow easy switch between parallelized and
non-parallelized runs such that the debugger can be reasonably used when
running the code. In practice, this allocates all the cpus available in ray
such that only a single trial can run at once.

TODO(hartikainen): This should allocate a custom "debug_resource" instead
of all cpus once ray local mode supports custom resources.
examples/instrument.py