Skip to content

Commit

Permalink
[tune] set correct path when deleting checkpoint folder (ray-project#…
Browse files Browse the repository at this point in the history
  • Loading branch information
YY-OnCall authored and richardliaw committed Jan 18, 2020
1 parent 303547f commit 9b1d295
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/ray/tune/trial.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ray.tune.registry import get_trainable_cls, validate_trainable
from ray.tune.result import DEFAULT_RESULTS_DIR, DONE, TRAINING_ITERATION
from ray.tune.resources import Resources, json_to_resources, resources_to_json
from ray.tune.trainable import TrainableUtil
from ray.tune.utils import flatten_dict
from ray.utils import binary_to_hex, hex_to_binary

Expand Down Expand Up @@ -88,7 +89,13 @@ def delete(checkpoint):
checkpoint_path = checkpoint.value
# Delete local copy, if any exists.
if os.path.exists(checkpoint_path):
shutil.rmtree(checkpoint_path)
try:
checkpoint_dir = TrainableUtil.find_checkpoint_dir(
checkpoint_path)
shutil.rmtree(checkpoint_dir)
except FileNotFoundError:
logger.warning("Checkpoint dir not found during deletion.")

# TODO(ujvl): Batch remote deletes.
runner.delete_checkpoint.remote(checkpoint.value)

Expand Down

0 comments on commit 9b1d295

Please sign in to comment.