Skip to content

[tune] ExperimentAnalysis doesn't expand user as docs imply #8821

@markgoodhead

Description

@markgoodhead

What is the problem?

The Ray docs give an example where a path with the "~" operator is included:
https://docs.ray.io/en/master/tune/api_docs/analysis.html#experimentanalysis-tune-experimentanalysis

>>> tune.run(my_trainable, name="my_exp", local_dir="~/tune_results")
>>> analysis = ExperimentAnalysis(
>>>     experiment_checkpoint_path="~/tune_results/my_exp/state.json")

This throws an error for me:

from ray.tune import ExperimentAnalysis
analysis = ExperimentAnalysis("~/rayexp/experiment_state-2020-06-06_20-22-19.json")

    203     def __init__(self, experiment_checkpoint_path, trials=None):
--> 204         with open(experiment_checkpoint_path) as f:
    205             _experiment_state = json.load(f)
    206             self._experiment_state = _experiment_state

FileNotFoundError: [Errno 2] No such file or directory: '~/rayexp/experiment_state-2020-06-06_20-22-19.json'

Whereas the corresponding expanded version does not:

from ray.tune import ExperimentAnalysis
from os.path import expanduser
analysis = ExperimentAnalysis(expanduser("~/rayexp/experiment_state-2020-06-06_20-22-19.json"))

Ray version and other system information (Python version, TensorFlow version, OS):

Ray 0.8.5
Python 3.8
Ubuntu 18

Reproduction (REQUIRED)

See description above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issue moderate in impact or severitybugSomething that is supposed to be working; but isn'ttuneTune-related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions