[tune/rllib] Add checkpoint eraser (#4490)

This commit is contained in:
Dušan Josipović
2019-04-06 20:01:54 -07:00
committed by Eric Liang
parent 7746d20d30
commit 820c71b7d0
6 changed files with 106 additions and 3 deletions
+11
View File
@@ -210,6 +210,17 @@ class Trainable(object):
return result
def delete_checkpoint(self, checkpoint_dir):
"""Removes subdirectory within checkpoint_folder
Parameters
----------
checkpoint_dir : path to checkpoint
"""
if os.path.isfile(checkpoint_dir):
shutil.rmtree(os.path.dirname(checkpoint_dir))
else:
shutil.rmtree(checkpoint_dir)
def save(self, checkpoint_dir=None):
"""Saves the current model state to a checkpoint.