1use crate::experiment::{ComputeDevice, CpuArchitecture, ModelParadigm, PlatformEfficiency};
4use serde::{Deserialize, Serialize};
5use std::collections::HashMap;
6
7#[derive(Debug, Clone)]
9pub struct RecipeResult {
10 pub recipe_name: String,
12 pub success: bool,
14 pub artifacts: Vec<String>,
16 pub metrics: HashMap<String, f64>,
18 pub error: Option<String>,
20}
21
22impl RecipeResult {
23 pub fn success(name: impl Into<String>) -> Self {
25 Self {
26 recipe_name: name.into(),
27 success: true,
28 artifacts: Vec::new(),
29 metrics: HashMap::new(),
30 error: None,
31 }
32 }
33
34 pub fn failure(name: impl Into<String>, error: impl Into<String>) -> Self {
36 Self {
37 recipe_name: name.into(),
38 success: false,
39 artifacts: Vec::new(),
40 metrics: HashMap::new(),
41 error: Some(error.into()),
42 }
43 }
44
45 pub fn with_artifact(mut self, artifact: impl Into<String>) -> Self {
47 self.artifacts.push(artifact.into());
48 self
49 }
50
51 pub fn with_metric(mut self, name: impl Into<String>, value: f64) -> Self {
53 self.metrics.insert(name.into(), value);
54 self
55 }
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct ExperimentTrackingConfig {
61 pub experiment_name: String,
63 pub paradigm: ModelParadigm,
65 pub device: ComputeDevice,
67 pub platform: PlatformEfficiency,
69 pub track_energy: bool,
71 pub track_cost: bool,
73 pub carbon_intensity: Option<f64>,
75 pub tags: Vec<String>,
77}
78
79impl Default for ExperimentTrackingConfig {
80 fn default() -> Self {
81 Self {
82 experiment_name: "default-experiment".to_string(),
83 paradigm: ModelParadigm::DeepLearning,
84 device: ComputeDevice::Cpu {
85 cores: 8,
86 threads_per_core: 2,
87 architecture: CpuArchitecture::X86_64,
88 },
89 platform: PlatformEfficiency::Server,
90 track_energy: true,
91 track_cost: true,
92 carbon_intensity: Some(400.0), tags: Vec::new(),
94 }
95 }
96}