Unverified Commit 55659eae authored by Ziqi Fan's avatar Ziqi Fan Committed by GitHub
Browse files

fix: early stop if CPU or disk space not set when using KVBM (#2997)


Signed-off-by: default avatarZiqi Fan <ziqif@nvidia.com>
parent eeb94dab
...@@ -333,7 +333,7 @@ ...@@ -333,7 +333,7 @@
"useBackend": false "useBackend": false
} }
], ],
"title": "Offload Blocks", "title": "Offload Blocks - Device to Host",
"type": "timeseries" "type": "timeseries"
}, },
{ {
...@@ -730,7 +730,7 @@ ...@@ -730,7 +730,7 @@
"useBackend": false "useBackend": false
} }
], ],
"title": "Onboard Blocks - Disk to Host", "title": "Onboard Blocks - Disk to Device",
"type": "timeseries" "type": "timeseries"
} }
], ],
...@@ -749,5 +749,5 @@ ...@@ -749,5 +749,5 @@
"timezone": "browser", "timezone": "browser",
"title": "KVBM Dashboard", "title": "KVBM Dashboard",
"uid": "3f679257-70a5-402c-92b4-05382337b548", "uid": "3f679257-70a5-402c-92b4-05382337b548",
"version": 5 "version": 7
} }
\ No newline at end of file
...@@ -86,6 +86,8 @@ impl KvbmLeader { ...@@ -86,6 +86,8 @@ impl KvbmLeader {
.build() .build()
.map_err(to_pyerr)?; .map_err(to_pyerr)?;
config.sanity_check().map_err(to_pyerr)?;
let rt = drt.inner().runtime().primary(); let rt = drt.inner().runtime().primary();
let leader = let leader =
......
...@@ -77,6 +77,35 @@ impl KvbmLeaderConfig { ...@@ -77,6 +77,35 @@ impl KvbmLeaderConfig {
pub fn builder() -> KvbmLeaderConfigBuilder { pub fn builder() -> KvbmLeaderConfigBuilder {
KvbmLeaderConfigBuilder::default() KvbmLeaderConfigBuilder::default()
} }
pub fn sanity_check(&self) -> anyhow::Result<()> {
let cpu = &self.host_blocks_config;
let disk = &self.disk_blocks_config;
if cpu.num_blocks_overriden == 0 && cpu.cache_size_in_gb == 0.0 {
if disk.num_blocks_overriden == 0 && disk.cache_size_in_gb == 0.0 {
panic!(
"KVBM Configuration Error: No CPU memory configured.\n\
\n\
To fix this, set one of the following environment variables:\n\
• DYN_KVBM_CPU_CACHE_GB=<size_in_gb> (e.g., DYN_KVBM_CPU_CACHE_GB=4)\n\
• DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS=<num_blocks> (e.g., DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS=1000)\n\
\n\
Example: export DYN_KVBM_CPU_CACHE_GB=4"
);
} else {
panic!(
"KVBM Configuration Error: CPU memory must be configured before disk memory.\n\
\n\
To fix this, set one of the following environment variables:\n\
• DYN_KVBM_CPU_CACHE_GB=<size_in_gb> (e.g., DYN_KVBM_CPU_CACHE_GB=4)\n\
• DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS=<num_blocks> (e.g., DYN_KVBM_CPU_CACHE_OVERRIDE_NUM_BLOCKS=1000)\n\
\n\
Example: export DYN_KVBM_CPU_CACHE_GB=4"
);
}
}
Ok(())
}
} }
#[derive(Debug, Default)] #[derive(Debug, Default)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment