chariots.savers

savers are used to persist and retrieve information about ops, nodes and pipeline (such as versions, persisted versions, datasets, and so on).

A saver can be viewed as the basic abstraction of a file system (interprets path) and always has a root path (that represents the path after which the saver will start persisting data).

For now chariots only provides a basic FileSaver saver but there are plans to add more in future releases (in particular to support bottomless cloud storage solutions such as aws s3 and Google cloud storage).

to create your own saver, you can subclass the BaseSaver class

To use a specific saver in your app, you will need to specify the saver class and the root path of the saver in the Chariots initialisation:

>>> my_app = Chariots(app_pipelines=my_pipelines, path=app_path, saver_cls=FileSaver, import_name="my_app")
class chariots.savers.FileSaver(root_path: str)[source]

Bases: chariots.base._base_saver.BaseSaver

a saver that persists to the local file system of the machine the Chariots saver is running on.

load(path: str) → bytes[source]

loads the bytes serialized at a specific path

Parameters

path – the path to load the bytes from.You should not include the root_path of the saver in this path: loading to /foo/bar.txt on a saver with /my/root/path as root path will load /my/root/path/foo/bar.txt

Returns

saved bytes

save(serialized_object: bytes, path: str) → bool[source]

saves bytes to a specific path.

Parameters
  • serialized_object – the bytes to persist

  • path – the path to save the bytes to. You should not include the root_path of the saver in this path: saving to /foo/bar.txt on a saver with /my/root/path as root path will create/update /my/root/path/foo/bar.txt

Returns

whether or not the object was correctly serialized.