ray.train.context.TrainContext.get_trial_dir#

TrainContext.get_trial_dir() str[source]#

Log directory corresponding to the trial directory for a Tune session. If calling from a Train session, this will give the trial directory of its parent Tune session.

from ray import train, tune

def train_func(config):
    print(train.get_context().get_trial_dir())

tuner = tune.Tuner(train_func)
tuner.fit()
/Users/root/ray_results/train_func_2023-07-19_15-01-37/train_func_d620c_00000_0_2023-07-19_15-01-40

PublicAPI (beta): This API is in beta and may change before becoming stable.

Warning

DEPRECATED: This API is deprecated and may be removed in future Ray releases. get_trial_dir is deprecated because the concept of a Trial will soon be removed in Ray Train (see here: ray-project/enhancements#57). Ray Train will no longer assume that it’s running within a Ray Tune Trial in the future.