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):
@classmethod
extension_map(cls):
@classmethod
build_canonical(cls, checkpoint):
Dispatches over types of objects to make a canonical checkpointer from the supplied data
checkpoint:None | str | Checkpoint | file | dictprovides
:returns:Checkpointer
@classmethod
from_file(cls, file, **opts):
Dispatch function to load from the appropriate file
file:str | Fileopts:Any:returns:_
__enter__(self):
__exit__(self, exc_type, exc_val, exc_tb):
cached_eval(self, key, generator, *, condition=None, args=(), kwargs=None):
@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:Anyvalue:Any:returns:_
load_parameter(self, key):
Loads a parameter from the checkpoint file
key:Any:returns:_
delete_parameter(self, key):
check_parameter(self, key):
update(self, vals):
get_keys(self, keys):
check_allowed_key(self, item):
__contains__(self, key):
__getitem__(self, item):
get(self, key, default=None):
__setitem__(self, key, value):
__delitem__(self, key):
pop(self, key, *default):
keys(self):
Returns the keys of currently checkpointed objects
:returns:_