Skip to main content

Tracker

Trait Tracker 

Source
pub trait Tracker: Send + Sync {
    // Required methods
    fn run_id(&self) -> &str;
    fn run_dir(&self) -> &Path;
    fn sink(&self) -> Arc<dyn EventSink>;
    fn save_manifest(&self, manifest: &RunManifest) -> Result<()>;
    fn save_artifact(&self, rel_path: &str, bytes: &[u8]) -> Result<()>;
    fn save_study(&self, study: &Study) -> Result<()>;
    fn heartbeat(&self) -> Result<()>;
    fn finalize(&self, state: RunState) -> Result<()>;
}
Expand description

A tracking backend bound to one run.

The local implementation writes a run directory; a remote backend can implement the same contract over HTTP.

Required Methods§

Source

fn run_id(&self) -> &str

Identifier of the run this tracker is bound to.

Source

fn run_dir(&self) -> &Path

Root directory of the run (for file-based backends).

Source

fn sink(&self) -> Arc<dyn EventSink>

The sink that persists events for this run.

Source

fn save_manifest(&self, manifest: &RunManifest) -> Result<()>

Atomically write the manifest.

Source

fn save_artifact(&self, rel_path: &str, bytes: &[u8]) -> Result<()>

Write an artifact at a path relative to the run directory, creating parent directories as needed.

Source

fn save_study(&self, study: &Study) -> Result<()>

Atomically write study.json (tmp + rename — readers never see a partial study, and a crash mid-write preserves the previous complete version).

Source

fn heartbeat(&self) -> Result<()>

Refresh heartbeat_at in the status file.

Source

fn finalize(&self, state: RunState) -> Result<()>

Set the terminal state, stamp finished_at, and flush the sink.

Implementors§