remove random selection policy — consumers can shuffle client-side

Plano should only handle ranking that requires server-side data
(cost metrics, latency). Random shuffling is trivial for callers.
This commit is contained in:
Adil Hafeez 2026-03-30 12:33:06 -07:00
parent 41e6b489f5
commit 5b869648c4
4 changed files with 1 additions and 23 deletions

View file

@ -126,7 +126,6 @@ impl ModelMetricsService {
}
rank_by_ascending_metric(models, &data)
}
SelectionPreference::Random => shuffle(models),
SelectionPreference::None => models.to_vec(),
}
}
@ -161,24 +160,6 @@ fn rank_by_ascending_metric(models: &[String], data: &HashMap<String, f64>) -> V
.collect()
}
fn shuffle(models: &[String]) -> Vec<String> {
use std::time::{SystemTime, UNIX_EPOCH};
let seed = SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|d| d.subsec_nanos() as usize)
.unwrap_or(0);
let mut result = models.to_vec();
let mut state = seed;
for i in (1..result.len()).rev() {
state = state
.wrapping_mul(6364136223846793005)
.wrapping_add(1442695040888963407);
let j = state % (i + 1);
result.swap(i, j);
}
result
}
#[derive(serde::Deserialize)]
struct CostEntry {
input_per_million: f64,

View file

@ -109,7 +109,6 @@ pub enum StateStorageType {
pub enum SelectionPreference {
Cheapest,
Fastest,
Random,
/// Return models in the same order they were defined — no reordering.
None,
}