Archive files
ArchiveStore
The ArchiveStore
interface lets you manage TAR archives transparently.
In the example below, the directory datasets
is archived and stored as a regular DataStore
asset.
Persisting the experiment triggers the creation of the archive.
Upon loading the experiment, the archive is extracted in the directory mltraq.archivestore
,
organized similarly to mltraq.datastore
by experiment ID.
Warning
Persisting an experiment is equivalent to removing and saving it, triggering the deletion
and recreation of its associated datastore assets, including its archives.
You can implement different behaviors with ArchiveStoreIO
and DataStoreIO
.
ArchiveStore example
Destination directory: 'mltraq.archivestore/d65df69e-1175-44a5-be2f-2232765703b8'
Contents of current directory:
[ 0] datasets
[ 1] datasets/first.csv
[ 2] datasets/second.csv
[ 3] mltraq.archivestore
[ 4] mltraq.archivestore/d65df69e-1175-44a5-be2f-2232765703b8
[ 5] mltraq.archivestore/d65df69e-1175-44a5-be2f-2232765703b8/e
[ 6] mltraq.archivestore/d65df69e-1175-44a5-be2f-2232765703b8/e/first.csv
[ 7] mltraq.archivestore/d65df69e-1175-44a5-be2f-2232765703b8/e/second.csv
[ 8] mltraq.datastore
[ 9] mltraq.datastore/d65df69e-1175-44a5-be2f-2232765703b8
[10] mltraq.datastore/d65df69e-1175-44a5-be2f-2232765703b8/d65df69e117544a5be2f2232765703ba
ArchiveStoreIO
The class ArchiveStoreIO
provides a lower-level interface to manage archives, bypassing the
organization by experiment IDs. Its implementation
relies on the glob
and tarfile
modules from the standard library. You can pass patterns to include or exclude and optionally include hidden files.
ArchiveStoreIO example
Contents of current directory:
[ 0] datasets
[ 1] datasets/first.csv
[ 2] datasets/second.csv
[ 3] mltraq.archivestore
[ 4] mltraq.archivestore/all
[ 5] mltraq.archivestore/all/assets
[ 6] mltraq.archivestore/all/assets/first.csv
[ 7] mltraq.archivestore/all/assets/second.csv
[ 8] mltraq.datastore
[ 9] mltraq.datastore/archives
[10] mltraq.datastore/archives/d65df69e117544a5be2f2232765703b8