Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions atom/mesh/mocker/app_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async fn create_mocker_context_inner(
worker_registry.clone(),
policy_registry.clone(),
client.clone(),
config.backend,
config.worker_startup_check_interval_secs,
)));
let worker_job_queue = Arc::new(OnceLock::new());
Expand Down
3 changes: 2 additions & 1 deletion atom/mesh/src/app_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,8 @@ impl AppContextBuilder {
.expect("policy_registry must be set")
.clone(),
client.clone(),
config.worker_startup_check_interval_secs,
config.backend,
config.load_sample_interval_secs(),
)));
self
}
Expand Down
33 changes: 33 additions & 0 deletions atom/mesh/src/config/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,39 @@ impl RouterConfig {
config
}

/// Interval for `power_of_two`'s load sample. Uses the smallest configured
/// `load_check_interval_secs`. Without that policy, the startup check
/// interval remains, and the monitor does not fetch.
pub fn load_sample_interval_secs(&self) -> u64 {
let mut intervals = Vec::new();
let mut push = |policy: &PolicyConfig| {
if let PolicyConfig::PowerOfTwo {
load_check_interval_secs,
} = policy
{
intervals.push(*load_check_interval_secs);
}
};
push(&self.policy);
if let RoutingMode::PrefillDecode {
prefill_policy,
decode_policy,
..
} = &self.mode
{
if let Some(policy) = prefill_policy {
push(policy);
}
if let Some(policy) = decode_policy {
push(policy);
}
}
intervals
.into_iter()
.min()
.unwrap_or(self.worker_startup_check_interval_secs)
}

pub fn resolved_prepare_pool(&self) -> ConfigResult<PoolConfig> {
let config = self.effective_prepare_pool();
let workers = config.workers.unwrap_or_else(default_prepare_workers);
Expand Down
Loading