mod checks;
mod files;
mod isolated;
mod names;
mod run;
mod set;
mod stopping;
use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use time::OffsetDateTime;
use argonauts_core::RunId;
use argonauts_core::future::BoxFuture;
use argonauts_core::names::ModelRef;
use argonauts_core::workflow::StandardPhase;
use crate::error::Result;
use crate::learned_workflows::LoadedLearnedWorkflow;
use crate::store::Store;
use crate::types::ReplayResult;
pub use isolated::isolated_repo;
pub use run::{Versions, replay, replay_workers, score, start_phase};
pub use set::{SplitReason, SplitRecord, draw_seed, holdout_draw};
pub use stopping::{StoppingRule, Verdict};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Entry {
pub id: String,
pub run: RunId,
pub task: String,
pub task_type: String,
pub base: String,
pub merged: String,
pub tests: Vec<PathBuf>,
pub test_command: Vec<String>,
pub limit_usd: f64,
pub holdout: bool,
#[serde(with = "time::serde::rfc3339")]
pub accepted: OffsetDateTime,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Proposal {
pub entry: Entry,
pub checks: Vec<Check>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Check {
pub name: String,
pub passed: bool,
pub detail: String,
}
impl Proposal {
pub fn valid(&self) -> bool {
self.checks.iter().all(|check| check.passed)
}
}
pub struct ReplaySet {
store: Store,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ReplayRequest {
pub entry: Entry,
pub learned_workflow: LoadedLearnedWorkflow,
pub repo: PathBuf,
pub limit_usd: f64,
pub from_phase: Option<StandardPhase>,
pub workers: Vec<ModelRef>,
pub hidden_paths: Vec<String>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct ReplayRun {
pub cost_usd: f64,
pub minutes: f64,
pub head: Option<String>,
}
pub trait ReplayRunner: Send + Sync {
fn run<'a>(&'a self, request: &'a ReplayRequest) -> BoxFuture<'a, Result<ReplayRun>>;
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct ReplayReport {
pub results: Vec<ReplayResult>,
pub spent_usd: f64,
pub stopped_early: bool,
pub at_limit: bool,
}