Checkpoint
Checkpoint is normally constructed and provided to you, but if you are interested, this can give you some details.
[4]:
from tune import Checkpoint
from triad import FileSystem
root = FileSystem()
fs = root.makedirs("/tmp/test", recreate=True)
checkpoint = Checkpoint(fs)
print(len(checkpoint))
0
[5]:
!ls /tmp/test
[6]:
with checkpoint.create() as folder:
folder.writetext("a.txt", "test")
[7]:
!ls /tmp/test
STATE d9ed2530-20f1-42b3-8818-7fbf1b8eedf3
Here is how to create a new checkpoint under /tmp/test
[8]:
with checkpoint.create() as folder:
folder.writetext("a.txt", "test2")
[9]:
!ls /tmp/test/*/
/tmp/test/8d4e7fed-2a4c-4789-a732-0cb46294e704/:
a.txt
/tmp/test/d9ed2530-20f1-42b3-8818-7fbf1b8eedf3/:
a.txt
Here is how to get the latest checkpoint folder
[10]:
print(len(checkpoint))
print(checkpoint.latest.readtext("a.txt"))
2
test2
[ ]: