Skip to main content

entrenar/dashboard/
mod.rs

1//! Dashboard Module (Phase 2: ENT-003, ENT-004)
2//!
3//! Provides the `DashboardSource` trait for real-time training monitoring
4//! and WASM bindings for browser-based dashboards.
5//!
6//! # Features
7//!
8//! - Real-time metric streaming via `subscribe()`
9//! - Resource usage monitoring (GPU, CPU, memory)
10//! - Trend analysis for metrics
11//! - WASM support for browser dashboards (feature: "wasm")
12//!
13//! # Example
14//!
15//! ```
16//! use std::sync::{Arc, Mutex};
17//! use entrenar::storage::{InMemoryStorage, ExperimentStorage};
18//! use entrenar::run::{Run, TracingConfig};
19//! use entrenar::dashboard::{DashboardSource, Trend};
20//!
21//! let mut storage = InMemoryStorage::new();
22//! let exp_id = storage.create_experiment("my-exp", None).expect("create experiment");
23//! let storage = Arc::new(Mutex::new(storage));
24//!
25//! let mut run = Run::new(&exp_id, storage.clone(), TracingConfig::disabled()).expect("create run");
26//! run.log_metric("loss", 0.5).expect("log metric");
27//! run.log_metric("loss", 0.4).expect("log metric");
28//! run.log_metric("loss", 0.3).expect("log metric");
29//!
30//! // Get dashboard data
31//! let status = run.status();
32//! let metrics = run.recent_metrics(10);
33//! let resources = run.resource_usage();
34//! ```
35
36mod snapshot;
37mod source;
38mod trend;
39
40#[cfg(feature = "wasm")]
41pub mod wasm;
42
43#[cfg(test)]
44mod tests;
45
46// Re-exports
47pub use snapshot::{MetricSnapshot, ResourceSnapshot};
48pub use source::{DashboardSource, SubscriptionCallback};
49pub use trend::Trend;