Disable dashboard

Is it possible to disable dashboard. The intention is to save resources.

You can disable the dashboard with the include-dashboard argument (ray start --include-dashboard=false - also can be specified in cluster config yaml under head_start_ray_commands or ray.init(include_dashboard=False).

Thanks for the follow-up. Could you be a bit more specific on how to disable the dashboard for the following example code:

import os
from ray import tune, air
from hyperopt import hp
from ray.tune.search.hyperopt import HyperOptSearch


# 1. Define an objective function.
def objective(config):
    score = config["a"] ** 2 + config["b"]
    #SCORE 1st apparence which defines the key of the dictionary, i.e. metric="SCORE",
    # or  return {"SCORE": score}
    tune.report(SCORE=score)  # this or the following return should work
    #return {"SCORE": score}


# 2. Define a search space.
search_space = {
    "a": hp.uniform("a", 0, 1),
    "b": hp.uniform("b", 0, 1)
    }

raw_log_dir = "./ray_log"
raw_log_name = "example"

algorithm = HyperOptSearch(search_space, metric="SCORE", mode="max")
if os.path.exists(os.path.join(raw_log_dir, raw_log_name)) == False:
    print('--- this is the 1st run ----')
else: #note: restoring described here doesn't work: https://docs.ray.io/en/latest/tune/tutorials/tune-stopping.html
    print('--- previous run exist, continue the tuning ----')
    algorithm.restore_from_dir(os.path.join(raw_log_dir, raw_log_name))

# 3. Start a Tune run and print the best result.
trainable_with_resources = tune.with_resources(objective, {"cpu": 8})
tuner = tune.Tuner(objective,
        tune_config = tune.TuneConfig(
            num_samples = 2, # number of tries. too expensive for Brian2
            search_alg=algorithm,
            ),
        param_space=search_space,
        run_config = air.RunConfig(local_dir = raw_log_dir, name = raw_log_name) # where to save the log which will be loaded later
        )

results = tuner.fit()
print(results.get_best_result(metric="SCORE", mode="max").config)

At the beginning of your script, call ray.init(include_dashboard=False).

Tuner.fit calls ray.init automatically if it hadn’t been called yet.

BTW. performance impact of the dashboard should be negligible.

1 Like

I include it as instructed but it still activate dashboard somehow. I got the following same message before it’s set to False:

2022-11-29 18:01:59,829 INFO worker.py:1519 -- Started a local Ray instance. View the dashboard at h

I believe this is a UX error on our part. If you set include_dashboard=False, the message will be printed regardless, and you will be able to connect to the dashboard webpage, but the process(es) responsible for collecting the metrics will not be initialized and no metrics will be shown on the webpage.

I’ll open an issue to not print that message if include_dashboard=False.

1 Like

Btw, could someone move this topic under “Dashboard” category instead of Ray AIR?