Repository navigation
Profile batch worker stages and connect queue-age scaling input - #22324
Git-on-my-level wants to merge 4 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20ab91afd3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…dapter rule - Inventory batch-pipeline-worker-metrics in expected-targets.prod.yaml. - Add the omi_batch_pipeline_ready_age_seconds external rule to the reviewed adapter upgrade expectation (diff_prod_adapter.py), rejecting any modified live copy. - Contract fixture models the pre-upgrade live config and finds the listen rule by name instead of by list position; add exact/modified/live-drift tests for the new rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
run_process now constructs SynchronizedWorker(..., timings=timings); the Sync Cloud Tasks gauntlet's CpuSynchronizedWorker override rejected that keyword, so batch-worker-1 exited before readiness. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fb6ee9b to
2382fc4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2382fc4c1b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The fetch_decode timer previously wrapped prefetch.take(), so under the production IO concurrency it measured only the later Future.result() wait; a decode overlapping earlier GPU work appeared nearly free. Wrap the decode callable submitted to the prefetch executor instead, keep the no-prefetch fallback timing decode directly, and document the measurement point.
|
Monitor run summary (rebase + review-thread completion):
No merge or deploy action taken. |
* feat(observability): profile dedicated batch pipeline stages behind a dev-default flag Add metrics-only per-stage wall-clock histograms for the dedicated batch GPU worker, adopting the instrumentation design of stalled PR #22324 (StageTimings context manager, static stage labels, omi_batch_pipeline_stage_seconds) without its HPA/scrape changes. Pump stages: pump_cycle, maintenance, pull, admission, renew, publication, ordered_merge, projection, worker_flight. Worker-chain leaves: fetch_decode, vad, windows, asr, asr_recovery, flight_segment, flight_diarize, diarize, persist, cuda_sync. Timings include executor wait and failed calls; prefetched decode and submitted persist are observed on the background IO threads where they run; optional or skipped stages emit no samples; telemetry failures are swallowed and never invalidate compute or durable transitions. BATCH_PIPELINE_STAGE_PROFILING_ENABLED gates histogram creation once at worker startup: default on only for OMI_ENV_STAGE=dev, prod/unset off, explicit true/false override (local/offline opt in). The histogram registers on the dedicated worker's explicit CollectorRegistry (/metrics). No runtime behavior, precision or concurrency change; cuda_sync times the pre-existing synchronize, profiling adds no new GPU synchronization. Speaker embedding stays inside the pyannote adapter seams (diarize / flight_diarize) and is documented as not separately timed. Failure-Class: none * feat(observability): separate batch artifact and speaker embedding stage timings Observe authenticated download, decrypt, decode, encryption and upload on the worker's actual IO thread, plus serial and packed pyannote embedding forwards. Keep labels static and telemetry failures isolated from compute and custody. Failure-Class: none * docs(observability): clarify batch timing scope and submillisecond buckets Failure-Class: none * feat(observability): profile retained batch source audio leaves Include generation-pinned retained downloads, framed decryption and codec decoding in the dedicated worker's scoped leaf timers. Non-worker callers remain unprofiled; ownership, validation and source bytes are unchanged. Failure-Class: none
There was a problem hiding this comment.
3 issues found across 14 files
Confidence score: 4/5
test_batch_pipeline_stage_timings.pycan skipdiarizefor the 2-second fixture when short-speech skipping is enabled, so the test may fail before checking telemetry. Pin the relevant stage flag.batch-pipeline-worker.mdnames stage labels that differ from the runtime values, which could lead to dashboards querying the wrong labels. Document the exact emitted values.batch-pipeline-worker.mdoverstates whatfetch_decodetimings cover: executor queueing and the laterfuture.result()wait are excluded. Clarify that scope.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/unit/test_batch_pipeline_stage_timings.py">
<violation number="1" location="backend/tests/unit/test_batch_pipeline_stage_timings.py:36">
P2: This integration-style assertion is environment-dependent: enabling the short-speech skip causes the 2-second fixture item to bypass `diarize`, so the test fails before validating telemetry. Pin the relevant stage flags in this test, as the worker fixture does.</violation>
</file>
<file name="backend/docs/batch-pipeline-worker.md">
<violation number="1" location="backend/docs/batch-pipeline-worker.md:216">
P3: The stage label values are not documented for most leaves. The runtime emits `windows`, `asr_recovery`, `diarize`, `persist`, and `cuda_sync`, not the prose names here; list the exact values so dashboards do not query nonexistent series.</violation>
<violation number="2" location="backend/docs/batch-pipeline-worker.md:219">
P3: `fetch_decode` timings do not include all executor wait for prefetched work. The timer starts only after the executor begins the callable, while executor queueing and the later `future.result()` wait are outside the observation; qualify this as execution time or measure submit-to-consumption time.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| async def test_real_pump_and_worker_export_one_cycle_with_nested_leaf_stages(): | ||
| registry = CollectorRegistry() | ||
| timings = StageTimings(registry) | ||
| worker, _, _, _, _, _ = setup_worker(timings=timings) |
There was a problem hiding this comment.
P2: This integration-style assertion is environment-dependent: enabling the short-speech skip causes the 2-second fixture item to bypass diarize, so the test fails before validating telemetry. Pin the relevant stage flags in this test, as the worker fixture does.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_batch_pipeline_stage_timings.py, line 36:
<comment>This integration-style assertion is environment-dependent: enabling the short-speech skip causes the 2-second fixture item to bypass `diarize`, so the test fails before validating telemetry. Pin the relevant stage flags in this test, as the worker fixture does.</comment>
<file context>
@@ -0,0 +1,66 @@
+async def test_real_pump_and_worker_export_one_cycle_with_nested_leaf_stages():
+ registry = CollectorRegistry()
+ timings = StageTimings(registry)
+ worker, _, _, _, _, _ = setup_worker(timings=timings)
+ store, _, pump = setup(worker, timings=timings)
+ assert await pump.run_once() == 1
</file context>
| worker, _, _, _, _, _ = setup_worker(timings=timings) | |
| monkeypatch.setenv('BATCH_PIPELINE_DIARIZE_SPEECH_ONLY_ENABLED', 'false') | |
| monkeypatch.setenv('BATCH_PIPELINE_SHORT_SPEECH_SINGLE_ENABLED', 'false') | |
| worker, _, _, _, _, _ = setup_worker(timings=timings) |
| for pull, maintenance, admission, full worker flight, publication, ordered merge, | ||
| and projection, plus fetch/decode, VAD, window assembly, ASR, padded retry, | ||
| diarization, encrypted result persistence, and final CUDA synchronization. |
There was a problem hiding this comment.
P3: The stage label values are not documented for most leaves. The runtime emits windows, asr_recovery, diarize, persist, and cuda_sync, not the prose names here; list the exact values so dashboards do not query nonexistent series.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/batch-pipeline-worker.md, line 216:
<comment>The stage label values are not documented for most leaves. The runtime emits `windows`, `asr_recovery`, `diarize`, `persist`, and `cuda_sync`, not the prose names here; list the exact values so dashboards do not query nonexistent series.</comment>
<file context>
@@ -212,6 +212,28 @@ Completion-only retention never expires pending work.
## Capacity and autoscaling
+The dedicated runtime exports `omi_batch_pipeline_stage_seconds{stage=...}`
+for pull, maintenance, admission, full worker flight, publication, ordered merge,
+and projection, plus fetch/decode, VAD, window assembly, ASR, padded retry,
+diarization, encrypted result persistence, and final CUDA synchronization.
</file context>
| for pull, maintenance, admission, full worker flight, publication, ordered merge, | |
| and projection, plus fetch/decode, VAD, window assembly, ASR, padded retry, | |
| diarization, encrypted result persistence, and final CUDA synchronization. | |
| for stages `pull`, `maintenance`, `admission`, `worker_flight`, `publication`, `ordered_merge`, | |
| `projection`, `fetch_decode`, `vad`, `windows`, `asr`, `asr_recovery`, `diarize`, `persist`, | |
| and `cuda_sync`. |
| Timings include failed operations and executor wait; a prefetched fetch/decode | ||
| is measured where it executes, not at the later consuming wait. `pump_cycle` contains the |
There was a problem hiding this comment.
P3: fetch_decode timings do not include all executor wait for prefetched work. The timer starts only after the executor begins the callable, while executor queueing and the later future.result() wait are outside the observation; qualify this as execution time or measure submit-to-consumption time.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/batch-pipeline-worker.md, line 219:
<comment>`fetch_decode` timings do not include all executor wait for prefetched work. The timer starts only after the executor begins the callable, while executor queueing and the later `future.result()` wait are outside the observation; qualify this as execution time or measure submit-to-consumption time.</comment>
<file context>
@@ -212,6 +212,28 @@ Completion-only retention never expires pending work.
+for pull, maintenance, admission, full worker flight, publication, ordered merge,
+and projection, plus fetch/decode, VAD, window assembly, ASR, padded retry,
+diarization, encrypted result persistence, and final CUDA synchronization.
+Timings include failed operations and executor wait; a prefetched fetch/decode
+is measured where it executes, not at the later consuming wait. `pump_cycle` contains the
+whole pass; `worker_flight` contains worker leaves and CUDA synchronization.
</file context>
| Timings include failed operations and executor wait; a prefetched fetch/decode | |
| is measured where it executes, not at the later consuming wait. `pump_cycle` contains the | |
| Timings include failed operations and executor wait for pump/model calls. Prefetched fetch/decode is timed inside its executor callable, excluding queueing and the later consuming wait. |
|
Folding batch (2026-11-04): this branch's tip was merged into the survivor PR #24477 ( |
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Production has one batch worker, a four-node dedicated L4 pool cap, and no working batch queue-age input to HPA. The adapter APIService is healthy, but its discovery lacks
omi_batch_pipeline_ready_age_seconds; the exact external metric request returns NotFound. The worker's PodMonitoring feeds managed Prometheus while the adapter reads local Prometheus, where the worker series is absent.Add the local worker scrape and scoped, freshness-filtered external adapter rule. Add content-free stage histograms across the real pump/model chain so pull, maintenance, worker flight, encrypted persistence, publication and ordered merge can be compared before selecting a concurrency change. Failed operations count; parent/child timings are documented. Replicas, HPA enablement, admission, model concurrency, ordering, privacy and lease behavior stay unchanged.
Validation: 142 focused tests passed in separate processes (stage timings 3, pump 14, worker 91, runtime 16, chart 18). The stage test drives the real Pump + PipelineWorker to committed state and tests failed timings and telemetry failure isolation.
make preflightpassed all 33 selected checks; runtime image source closure passed for all 14 images. Local/metricshealth-server tests exercise the registry path. Existing PR #22201 mixed-fleet virtual-clock scenario passed at its own head; its modeled timings are not a production capacity benchmark. No GPU, multi-node, deployment or load-hold acceptance is claimed.Live investigation used ro-prod only, aggregate metrics/log output, copied KUBECONFIG, explicit production context and cleared copied auth caches. The observed worker digest is
sha256:fa484829a2a7e5c3f10d9f7013250f8e23dbebe893c8457bc067647d375a8a72, bound to build head6fb2c6f7fad7145852fa0998f60a89ecb09c04baby deployment run 39137005992. No production write was performed. After separate deployment approval, verify fresh external series for all priorities and qualify scaling before enabling HPA; the current pool cap and cold-start delay still apply.Failure-Class: none
This change repairs an omitted metrics connection and adds the missing measurements; it does not change a domain mutation contract. No merge or deploy is requested.