mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
Remove ranked minimal selection compatibility helper
This commit is contained in:
@@ -10,8 +10,10 @@ use aether_data_contracts::repository::candidates::{
|
||||
RequestCandidateStatus, StoredRequestCandidate,
|
||||
};
|
||||
use aether_scheduler_core::{
|
||||
build_ranked_minimal_candidate_selection, BuildMinimalCandidateSelectionInput,
|
||||
SchedulerMinimalCandidateSelectionCandidate, SchedulerPriorityMode,
|
||||
apply_scheduler_candidate_ranking, enumerate_minimal_candidate_selection,
|
||||
EnumerateMinimalCandidateSelectionInput, SchedulerMinimalCandidateSelectionCandidate,
|
||||
SchedulerPriorityMode, SchedulerRankableCandidate, SchedulerRankingContext,
|
||||
SchedulerRankingMode,
|
||||
};
|
||||
|
||||
use crate::cache::SchedulerAffinityTarget;
|
||||
@@ -94,18 +96,36 @@ async fn same_priority_candidates_are_distributed_by_affinity_key() {
|
||||
.await
|
||||
.expect("selection rows should read")
|
||||
.expect("selection rows should match requested model");
|
||||
let selection = build_ranked_minimal_candidate_selection(BuildMinimalCandidateSelectionInput {
|
||||
rows,
|
||||
normalized_api_format: "openai:chat",
|
||||
requested_model_name: "gpt-4.1",
|
||||
resolved_global_model_name: "gpt-4.1",
|
||||
require_streaming: false,
|
||||
required_capabilities: None,
|
||||
auth_constraints: None,
|
||||
affinity_key: Some(auth_snapshot.api_key_id.as_str()),
|
||||
priority_mode: SchedulerPriorityMode::Provider,
|
||||
})
|
||||
.expect("selection should succeed");
|
||||
let mut selection =
|
||||
enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
|
||||
rows,
|
||||
normalized_api_format: "openai:chat",
|
||||
requested_model_name: "gpt-4.1",
|
||||
resolved_global_model_name: "gpt-4.1",
|
||||
require_streaming: false,
|
||||
required_capabilities: None,
|
||||
auth_constraints: None,
|
||||
})
|
||||
.expect("selection should succeed");
|
||||
let rankables = selection
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, candidate)| {
|
||||
SchedulerRankableCandidate::from_candidate(candidate, index).with_affinity_hash(Some(
|
||||
candidate_affinity_hash(auth_snapshot.api_key_id.as_str(), candidate),
|
||||
))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
apply_scheduler_candidate_ranking(
|
||||
&mut selection,
|
||||
&rankables,
|
||||
SchedulerRankingContext {
|
||||
priority_mode: SchedulerPriorityMode::Provider,
|
||||
ranking_mode: SchedulerRankingMode::CacheAffinity,
|
||||
include_health: false,
|
||||
load_balance_seed: 0,
|
||||
},
|
||||
);
|
||||
|
||||
assert_eq!(selection.len(), 2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user