Checkpointer
General purpose base class that allows checkpointing to be done easily and cleanly. Intended to be a passable object that allows code to checkpoint easily.
default_extension: str
__init__(self, checkpoint_file, allowed_keys=None, omitted_keys=None):
__repr__(self):
extension_map():
build_canonical(checkpoint):
Dispatches over types of objects to make a canonical checkpointer from the supplied data
checkpoint
:None | str | Checkpoint | file | dict
provides
:returns
:Checkpointer
from_file(file, **opts):
Dispatch function to load from the appropriate file
file
:str | File
opts
:Any
:returns
:_
__enter__(self):
__exit__(self, exc_type, exc_val, exc_tb):
@property
is_open(self):
@property
stream(self):
open_checkpoint_file(self, chk):
Opens the passed checkpoint_file
(if not already open)
chk
:Any
:returns
:_
close_checkpoint_file(self, stream):
Closes the opened checkpointing stream
stream
:Any
:returns
:_
save_parameter(self, key, value):
Saves a parameter to the checkpoint file
key
:Any
value
:Any
:returns
:_
load_parameter(self, key):
Loads a parameter from the checkpoint file
key
:Any
:returns
:_
check_allowed_key(self, item):
__getitem__(self, item):
__setitem__(self, key, value):
keys(self):
Returns the keys of currently checkpointed objects
:returns
:_