Skip to content

Commit 30b9dbf

Browse files
author
root
committed
Clarify live sample counts in debug profile
1 parent 91d8d5e commit 30b9dbf

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/routes.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,17 @@ async fn debug_profile(
243243
let model_mtime = std::fs::metadata(&model_path)
244244
.ok()
245245
.and_then(|meta| meta.modified().ok());
246-
let sample_count = profile
246+
let live_sample_count = SampleStorage::open_read_only(profile.history_rocks_path())
247+
.ok()
248+
.and_then(|storage| storage.sample_count())
249+
.map(|count| count as usize);
250+
let training_status_sample_count = profile
247251
.training_status()
248252
.as_ref()
249253
.and_then(|status| status.get("sample_count"))
250254
.and_then(Value::as_u64)
251-
.unwrap_or(0) as usize;
255+
.map(|count| count as usize);
256+
let sample_count = live_sample_count.or(training_status_sample_count).unwrap_or(0);
252257
let training_decision = evaluate_training_need(
253258
&profile,
254259
sample_count,
@@ -266,6 +271,8 @@ async fn debug_profile(
266271
"fasttext_model_path": profile.fasttext_model_path(),
267272
"hashlinear_model_path": profile.hashlinear_model_path(),
268273
"local_model_exists": profile.local_model_exists(),
274+
"live_sample_count": live_sample_count,
275+
"training_status_sample_count": training_status_sample_count,
269276
"training_status": profile.training_status(),
270277
"training_decision": training_decision,
271278
"config": profile.config

0 commit comments

Comments
 (0)