On experiment begin & end callback from head node

How do I achieve with tune.run today?

  1. on_experiment_begin_callback(ray_config) which runs some prep script only on the head node using the ray_config
  2. on_experiment_end_callback(ray_config) which runs some clean up script only on the head node using the ray_config

Can you say more about what you are trying to achieve here?

I’m trying to create and teardown a custom cluster of machines in the respective cbs

Is this the same cluster that Tune is running on? If it is, I don’t think these callbacks are intended for that.

Yes, they are in the same cluster. I’m thinking of writing a wrapper on top of tune.run like so,

def my_tune_run(cluster_config, **kwargs):
  cid = my_start_cluster(cluster_config)
  tune.run(**kwargs)
  my_stop_cluster(cid)

Got this idea while brainstorming with your here :slight_smile: