pub struct Predictor { /* private fields */ }Expand description
Predicts a job’s peak from the runs it learned.
Implementations§
Source§impl Predictor
impl Predictor
Sourcepub fn new(rules: &Sizing) -> Predictor
pub fn new(rules: &Sizing) -> Predictor
A predictor that knows no run yet, with [sizing]’s margin and minimum runs.
Sourcepub fn read(
rules: &Sizing,
history: &History,
cap_of: impl Fn(&str) -> Option<u64>,
) -> Predictor
pub fn read( rules: &Sizing, history: &History, cap_of: impl Fn(&str) -> Option<u64>, ) -> Predictor
A predictor that learned every row of history, in the order they finished, each under the cap its
container had, else cap_of(profile): what the daemon reads every minute, and again after a restart.
Sourcepub fn learn(&mut self, run: &Ran, profile: &str, cap: u64, at: u64)
pub fn learn(&mut self, run: &Ran, profile: &str, cap: u64, at: u64)
Learns a finished run of profile that ended at at (ms), having run under cap: its peak, how it ended,
and its CPU. Runs must come in the order they finished (recent::Recent::read).
Sourcepub fn learn_cpu(&mut self, run: &Ran, profile: &str)
pub fn learn_cpu(&mut self, run: &Ran, profile: &str)
Learns the CPU a finished run of profile used, without its peak.
Sourcepub fn predict_cpu(&self, key: &Key, profile: &str, cap: u64) -> CpuPrediction
pub fn predict_cpu(&self, key: &Key, profile: &str, cap: u64) -> CpuPrediction
The CPU to reserve for a run of key in profile, whose cpus are cap millicores: the job’s average
CPU (its CPU time over its run time), by the same fallbacks as memory without the margin. CPU is shared, not
a kill limit, so neither a run at its cap nor copies of the job beside it change it.
Sourcepub fn mark(&mut self, run: &Ran, profile: &str, cap: u64, at: u64)
pub fn mark(&mut self, run: &Ran, profile: &str, cap: u64, at: u64)
Learns a cancelled run of profile: how it ended, and its peak only when it met its cap. A run that met
its cap or was killed for memory holds its job in that profile at its cap (Ran::capped), a peak past what
it reserved makes it reserve its largest peak while that run is in its window.