Bound destination compile latency
This commit is contained in:
parent
0a830347dc
commit
fc46c3ba61
1 changed files with 15 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ const FAST_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(120);
|
||||||
const BALANCED_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(180);
|
const BALANCED_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(180);
|
||||||
const CAPABLE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(300);
|
const CAPABLE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(300);
|
||||||
const WORLD_COMPILE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(600);
|
const WORLD_COMPILE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(600);
|
||||||
|
const DESTINATION_COMPILE_ATTEMPT_TIMEOUT: Duration = Duration::from_secs(600);
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct CodexConnectorModelPort {
|
pub struct CodexConnectorModelPort {
|
||||||
|
|
@ -217,6 +218,7 @@ impl ModelPort for CodexConnectorModelPort {
|
||||||
fn attempt_timeout(&self, request: &ModelStageRequest) -> Duration {
|
fn attempt_timeout(&self, request: &ModelStageRequest) -> Duration {
|
||||||
match (request.stage.as_str(), request.model.as_str()) {
|
match (request.stage.as_str(), request.model.as_str()) {
|
||||||
("world_compile", MODEL_CAPABLE) => WORLD_COMPILE_ATTEMPT_TIMEOUT,
|
("world_compile", MODEL_CAPABLE) => WORLD_COMPILE_ATTEMPT_TIMEOUT,
|
||||||
|
("destination_compile", MODEL_CAPABLE) => DESTINATION_COMPILE_ATTEMPT_TIMEOUT,
|
||||||
(_, MODEL_BALANCED) => BALANCED_ATTEMPT_TIMEOUT,
|
(_, MODEL_BALANCED) => BALANCED_ATTEMPT_TIMEOUT,
|
||||||
(_, MODEL_CAPABLE) => CAPABLE_ATTEMPT_TIMEOUT,
|
(_, MODEL_CAPABLE) => CAPABLE_ATTEMPT_TIMEOUT,
|
||||||
_ => FAST_ATTEMPT_TIMEOUT,
|
_ => FAST_ATTEMPT_TIMEOUT,
|
||||||
|
|
@ -985,7 +987,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn foundation_compile_gets_a_bounded_stage_specific_deadline() -> Result<()> {
|
fn large_compile_stages_get_bounded_specific_deadlines() -> Result<()> {
|
||||||
let port = CodexConnectorModelPort::new(
|
let port = CodexConnectorModelPort::new(
|
||||||
"127.0.0.1:4103".parse()?,
|
"127.0.0.1:4103".parse()?,
|
||||||
"bounded-test-key".to_string(),
|
"bounded-test-key".to_string(),
|
||||||
|
|
@ -1020,6 +1022,18 @@ mod tests {
|
||||||
request.model = MODEL_CAPABLE.to_string();
|
request.model = MODEL_CAPABLE.to_string();
|
||||||
assert_eq!(port.attempt_timeout(&request), CAPABLE_ATTEMPT_TIMEOUT);
|
assert_eq!(port.attempt_timeout(&request), CAPABLE_ATTEMPT_TIMEOUT);
|
||||||
|
|
||||||
|
request.stage = "destination_compile".to_string();
|
||||||
|
assert_eq!(
|
||||||
|
port.attempt_timeout(&request),
|
||||||
|
DESTINATION_COMPILE_ATTEMPT_TIMEOUT
|
||||||
|
);
|
||||||
|
|
||||||
|
request.model = MODEL_BALANCED.to_string();
|
||||||
|
assert_eq!(port.attempt_timeout(&request), BALANCED_ATTEMPT_TIMEOUT);
|
||||||
|
|
||||||
|
request.model = MODEL_FAST.to_string();
|
||||||
|
assert_eq!(port.attempt_timeout(&request), FAST_ATTEMPT_TIMEOUT);
|
||||||
|
|
||||||
request.stage = "destination_civic_reconciliation".to_string();
|
request.stage = "destination_civic_reconciliation".to_string();
|
||||||
request.model = MODEL_BALANCED.to_string();
|
request.model = MODEL_BALANCED.to_string();
|
||||||
assert_eq!(port.attempt_timeout(&request), BALANCED_ATTEMPT_TIMEOUT);
|
assert_eq!(port.attempt_timeout(&request), BALANCED_ATTEMPT_TIMEOUT);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue