Repository navigation
feat: expose slot progress/status for #451 - #55
Merged
Merged
Conversation
- Extend server_task_result_hydra_state with progress fields (operation, progress, tokens_processed, tokens_total, elapsed_ms) - Populate progress fields based on slot state in HYDRA_STATE_META handler - Update to_json() to include progress fields in META response - Map slot states to operation strings (prefill, decode, idle, etc.)
3 tasks done
prompt.tokens.size() grows during prefill — it's the current count, not the total. task->n_tokens() is the fixed total (e.g., 100K). Before: tokens_total = slot->prompt.tokens.size() (wrong, grows) After: tokens_total = slot->task->n_tokens() (correct, fixed) This matches llama.cpp's own progress calculation at line 501: f_progress = prompt.n_tokens() / task->n_tokens() So for a 100K token prefill at 48980 tokens processed: tokens_processed = 48980 tokens_total = 100000 progress = 0.4898
Add timing and throughput metrics to PREFILL RPC response: - prefill_ms: actual prefill time in milliseconds - model_load_ms: model load time if swap happened (ms) - prompt_tokens: total tokens processed - tokens_per_second: throughput during prefill - cache_tokens: tokens from cache - kv_size: KV state size in bytes - logits_size: logits size in bytes These metrics enable Hydra Core to: - Track prefill performance over time - Identify load bottlenecks (model load vs prefill) - Understand throughput patterns - Detect anomalies in prefill operations
n_remaining defaults to -1 (unlimited generation) when no finite n_predict is set. Computing tokens_total = n_decoded + (-1) overflows, producing progress > 1.0. Guard: only compute decode progress when n_remaining > 0.
When hydra_transferring flips operation to 'save', the previous state's progress/tokens_processed/tokens_total/elapsed_ms are stale and contradictory (e.g. operation='save' alongside progress=1.0 from idle). Zero all four fields so the response is self-consistent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
/slots/:id/state/metaendpoint with per-slot progress fields so thatHydra Core can distinguish legitimately busy slots from stuck ones.
Changes
operation,progress,tokens_processed,tokens_total,elapsed_mstoserver_task_result_hydra_stateto_json()META responseRefs