Crates.io | mlmd |
lib.rs | mlmd |
version | 0.3.0 |
source | src |
created_at | 2021-01-18 01:05:30.33279 |
updated_at | 2022-04-03 10:09:11.469517 |
description | A Rust implementation of ml-metadata |
homepage | https://github.com/sile/mlmd |
repository | https://github.com/sile/mlmd |
max_upload_size | |
id | 343326 |
size | 440,759 |
A Rust implementation of ml-metadata.
This crate supports the schema version 8 used in ml-metadata-v1.7.0 or later.
use mlmd::MetadataStore;
use mlmd::metadata::EventType;
use tempfile::NamedTempFile;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Creates metadata store.
let db_file = NamedTempFile::new()?;
let sqlite_uri = format!("sqlite://{}", db_file.path().to_str().unwrap());
let mut store = MetadataStore::connect(&sqlite_uri).await?;
// Creates an artifact.
let artifact_type_id = store.put_artifact_type("DataSet").execute().await?;
let artifact_id = store.post_artifact(artifact_type_id).uri("/foo/bar").execute().await?;
// Creates an execution.
let execution_type_id = store.put_execution_type("Training").execute().await?;
let execution_id = store.post_execution(execution_type_id).execute().await?;
// Links the above execution with the artifact.
store.put_event(execution_id, artifact_id).ty(EventType::Input).execute().await?;
// Gets executions.
let executions = store.get_executions().execute().await?;
assert_eq!(executions.len(), 1);
assert_eq!(executions[0].id, execution_id);
Ok(())
}
The following features are not supported yet:
input_type
and output_type
fields of Execution
The following features are not planned to be supported:
ml-metadata
References