How to interactively stop running trials

How to interactively stop running trials when using tune.run()? Stopping certain ones at my choosing. I usually monitor the live training via tensorboard. I start a RLlib training similar to below. There are custom_metrics captured via callbacks. I know about the stop config dict for tune.run(). However, sometimes I just want to interactively stop some trials because I am actively experimenting.

import ray
from ray import tune

from ray.rllib.examples.env.random_env import RandomEnv

config = {
  "env": RandomEnv,
  "lr" : tune.grid_search([1e-3, 1e-4, 1e-5, 1e-6]),
}

stop = {
  "training_iteration": 5,
}

ray.init()


results = tune.run(
  "A3C",
  name="test-lr_schedule",
  config=config, 
  stop=stop, 
)

ray.shutdown()

You could use the Tune Client API: Tune Client API — Ray v2.0.0.dev0

1 Like