pub trait ExperimentStorage: Send + Sync {
// Required methods
fn create_experiment(
&mut self,
name: &str,
config: Option<Value>,
) -> Result<String>;
fn create_run(&mut self, experiment_id: &str) -> Result<String>;
fn start_run(&mut self, run_id: &str) -> Result<()>;
fn complete_run(&mut self, run_id: &str, status: RunStatus) -> Result<()>;
fn log_metric(
&mut self,
run_id: &str,
key: &str,
step: u64,
value: f64,
) -> Result<()>;
fn log_artifact(
&mut self,
run_id: &str,
key: &str,
data: &[u8],
) -> Result<String>;
fn get_metrics(&self, run_id: &str, key: &str) -> Result<Vec<MetricPoint>>;
fn get_run_status(&self, run_id: &str) -> Result<RunStatus>;
fn set_span_id(&mut self, run_id: &str, span_id: &str) -> Result<()>;
fn get_span_id(&self, run_id: &str) -> Result<Option<String>>;
}Expand description
Trait for experiment storage backends
This trait abstracts over different storage implementations, allowing for production use with TruenoDB and testing with in-memory storage.
§Thread Safety
All implementations must be Send + Sync to support concurrent access
from multiple training threads.
Required Methods§
Sourcefn create_run(&mut self, experiment_id: &str) -> Result<String>
fn create_run(&mut self, experiment_id: &str) -> Result<String>
Sourcefn complete_run(&mut self, run_id: &str, status: RunStatus) -> Result<()>
fn complete_run(&mut self, run_id: &str, status: RunStatus) -> Result<()>
Complete a run with the given status
§Arguments
run_id- ID of the runstatus- Final status (Success, Failed, or Cancelled)
Sourcefn log_metric(
&mut self,
run_id: &str,
key: &str,
step: u64,
value: f64,
) -> Result<()>
fn log_metric( &mut self, run_id: &str, key: &str, step: u64, value: f64, ) -> Result<()>
Log a metric value for a run
§Arguments
run_id- ID of the runkey- Metric name (e.g., “loss”, “accuracy”)step- Training step or epoch numbervalue- Metric value
Sourcefn get_metrics(&self, run_id: &str, key: &str) -> Result<Vec<MetricPoint>>
fn get_metrics(&self, run_id: &str, key: &str) -> Result<Vec<MetricPoint>>
Sourcefn get_run_status(&self, run_id: &str) -> Result<RunStatus>
fn get_run_status(&self, run_id: &str) -> Result<RunStatus>
Get the current status of a run