border-mlflow-tracking 0.0.8

MLFlow tracking for Border
Documentation
use serde::Deserialize;

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
pub struct Run {
    pub info: RunInfo,
    data: Option<RunData>,
    inputs: Option<RunInputs>,
}

impl Run {
    pub fn exist_tag(&self, key: &str) -> bool {
        if let Some(data) = &self.data {
            if let Some(tags) = &data.tags {
                for tag in tags.iter() {
                    if tag.key.as_str() == key {
                        return true;
                    }
                }
            }
        }
        return false;
    }
}

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
pub struct RunInfo {
    pub run_id: String,
    pub run_name: String,
    pub experiment_id: String,
    pub status: Option<String>,
    pub start_time: i64,
    pub end_time: Option<i64>,
    pub artifact_uri: Option<String>,
    pub lifecycle_stage: Option<String>,
}

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
struct RunData {
    metrics: Option<Vec<Metric>>,
    params: Option<Vec<Param>>,
    tags: Option<Vec<RunTag>>,
}

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
/// TODO: implement
struct RunInputs {}

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
struct RunTag {
    key: String,
    value: String,
}

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
struct Param {
    key: String,
    value: String,
}

#[allow(dead_code)]
#[derive(Clone, Debug, Deserialize)]
struct Metric {
    key: String,
    value: f64,
    timestamp: i64,
    step: i64,
}