Creating Bundles with the Python API
Install examples, use API to version your data
Last updated
Was this helpful?
Install examples, use API to version your data
Last updated
Was this helpful?
How to use the Disdat Python API to create and clear a local context
How to use the API to create simple bundles that store scalars, lists, or dictionaries
How to use Disdat to create managed output paths so you can store output files in your bundles.
Clone the examples github repo (https://github.com/seanr15/disdat-examples)
We'll assume you've installed it in $CODE
Change directories into your project:cd $CODE
Assuming you are in your virtual environment, install the example project: pip install -e .
Bundles collect a set of literals and files as a versioned unit
The Python Bundle API can present your bundle as basic Python types, see .
Bundles can store any number of user tags
Bundles can also track parameters, git information, timing, and lineage
Bundles can also hold links to files. These are strings that look like file paths. You can add external files by simply adding the path to the bundle. Note that this will make a copy of the file -- you're versioning this particular output.
But Disdat can create managed output paths -- you only need to provide the name of the output file, not where it's stored! Here we version two output files in a bundle.
Here we use the api search method to find all versions of the bundle "example_data" . We print out the creation date as well as the Bundle.data
field.
This (from the git repo above) has more examples than just the ones below. Follow along and explore those as well!
Disdat can also manage S3 files. If you , you can place S3 files into a bundle in the same way as local files. You can either add an S3 path directly, or you can call Bundle.get_remote_file
to get a path on S3 at which to store your file. You can also ask for and add local and remote directories by using Bundle.get_directory
and Bundle.get_remote_directory
Check out another ("5_store_models_using_bundle_api") that shows how to use the API to store pickled scikit learn models, retrieve them, and use them for prediction.