[sgl-router] refactor - move policy-required states under src/state (#40272)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
acd20a516e
commit
4a9dc5c4af
@@ -7,11 +7,10 @@ use std::time::{Duration, Instant};
|
||||
use axum::body::Body;
|
||||
use axum::http::{Request, StatusCode};
|
||||
use sgl_router::config::{
|
||||
ActiveLoadConfig, Config, DiscoveryBackend, ModelConfig, ObservabilityConfig, PolicyKind,
|
||||
Config, DiscoveryBackend, InflightLoadConfig, ModelConfig, ObservabilityConfig, PolicyKind,
|
||||
ProxyConfig, ServerConfig, StaticUrlsDiscoveryConfig,
|
||||
};
|
||||
use sgl_router::discovery::{ModelId, WorkerId, WorkerMode, WorkerSpec};
|
||||
use sgl_router::policies::engine_load::{LoadStat, NativeCacheRankLoad};
|
||||
use sgl_router::policies::{
|
||||
CacheCandidate, CacheCandidateProposal, Policy, PolicyRegistry, PrefillProposal, ProposalKind,
|
||||
SelectionContext, SelectionProposal,
|
||||
@@ -19,6 +18,7 @@ use sgl_router::policies::{
|
||||
use sgl_router::proxy::Proxy;
|
||||
use sgl_router::server::app::build_router;
|
||||
use sgl_router::server::app_context::AppContext;
|
||||
use sgl_router::state::load_monitor::engine_reported_load::{LoadStat, NativeCacheRankLoad};
|
||||
use sgl_router::tokenizer::TokenizerRegistry;
|
||||
use sgl_router::workers::{Worker, WorkerRegistry};
|
||||
use tower::ServiceExt;
|
||||
@@ -165,7 +165,7 @@ fn config(policy: PolicyKind) -> Config {
|
||||
urls: vec!["http://placeholder:0".into()],
|
||||
}),
|
||||
proxy: ProxyConfig::default(),
|
||||
active_load: ActiveLoadConfig::default(),
|
||||
router_inflight_load: InflightLoadConfig::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ async fn chat_commits_the_admitted_prefill_backup() {
|
||||
total_prefill_busy_us,
|
||||
}),
|
||||
};
|
||||
fixture.ctx.engine_load.set(
|
||||
fixture.ctx.engine_reported_load.set(
|
||||
&fixture.workers[0].url,
|
||||
0,
|
||||
native_load(1, 1),
|
||||
@@ -315,7 +315,7 @@ async fn chat_commits_the_admitted_prefill_backup() {
|
||||
);
|
||||
fixture
|
||||
.ctx
|
||||
.engine_load
|
||||
.engine_reported_load
|
||||
.set(&fixture.workers[0].url, 0, native_load(2, 2), now);
|
||||
|
||||
assert_eq!(send_chat(&fixture.ctx).await, StatusCode::OK);
|
||||
@@ -351,7 +351,7 @@ async fn capacity_exhaustion_does_not_return_503() {
|
||||
})
|
||||
.await;
|
||||
for worker in &fixture.workers {
|
||||
fixture.ctx.engine_load.set(
|
||||
fixture.ctx.engine_reported_load.set(
|
||||
&worker.url,
|
||||
0,
|
||||
LoadStat {
|
||||
@@ -434,7 +434,7 @@ async fn chat_records_cache_candidates_exhausted() {
|
||||
})
|
||||
})
|
||||
.await;
|
||||
fixture.ctx.engine_load.set(
|
||||
fixture.ctx.engine_reported_load.set(
|
||||
&fixture.workers[0].url,
|
||||
0,
|
||||
LoadStat {
|
||||
|
||||
Reference in New Issue
Block a user