Skip to content

feat: add progress_callback to wait_processed() for real-time progress monitoring#125

Draft
nayagamez wants to merge 2 commits intovolcengine:mainfrom
nayagamez:feat/progress-callback
Draft

feat: add progress_callback to wait_processed() for real-time progress monitoring#125
nayagamez wants to merge 2 commits intovolcengine:mainfrom
nayagamez:feat/progress-callback

Conversation

@nayagamez
Copy link

Summary

  • Add optional progress_callback parameter to wait_processed() throughout the client chain
  • Add total property to QueueStatus for convenient progress calculation
  • Fully backward compatible — existing callers are unaffected

Motivation

When wait_processed() blocks for long-running indexing operations (e.g., hundreds
of files), callers have no way to report progress to users. The internal queue status
(pending, in_progress, processed, error_count) is already tracked but only
returned after completion.

This change exposes that status during the wait loop via an optional callback, enabling
callers to build accurate progress bars, logging, or monitoring dashboards.

Changes

  • QueueStatus: add total property (sum of all state fields)
  • QueueManager.wait_complete(): add progress_callback parameter, invoked each poll iteration
  • ResourceService.wait_processed(): adapt QueueStatus → dict at boundary, thread callback
  • BaseClient / LocalClient / HTTPClient: update abstract signature and implementations
  • AsyncOpenViking / SyncOpenViking: thread parameter through

Example Usage

def on_progress(status):
    for queue_name, s in status.items():
        pct = (s["processed"] / s["total"] * 100) if s["total"] > 0 else 0
        print(f"{queue_name}: {pct:.0f}% ({s['processed']}/{s['total']})")

client.wait_processed(timeout=600, progress_callback=on_progress)

Test plan

  • QueueStatus.total property returns correct sum
  • Callback invoked on each poll iteration with correct status dict
  • No callback (None) works identically to current behavior
  • Timeout still works with callback provided
  • ResourceService adapts QueueStatus → dict with total field
  • HTTPClient accepts parameter without error (no-op)
  • Existing tests pass unchanged

All tests in tests/client/test_wait_progress.py (10 tests, 3 test classes).

@CLAassistant
Copy link

CLAassistant commented Feb 10, 2026

CLA assistant check
All committers have signed the CLA.

@nayagamez nayagamez force-pushed the feat/progress-callback branch from 733c1f5 to 77903b0 Compare February 10, 2026 15:57
@MaojiaSheng
Copy link
Collaborator

MaojiaSheng commented Feb 11, 2026

Thanks, @nayagamez but we have a concern that, we are working with server/client arch, and this PR depends on a embed mode. If one day the Queue is on a remote server, your contribution will cause fail.

I suggest more decouple design on this issue.

@MaojiaSheng
Copy link
Collaborator

Another idea is that, wait_processed callback should be implemented after #115 transaction. After that, we can register a event queue for each transaction, and then you can get events for the transaction.

@MaojiaSheng MaojiaSheng marked this pull request as draft February 13, 2026 13:31
Re-apply progress_callback support on upstream v0.1.17.
Threads callback through: QueueManager → ResourceService → LocalClient → AsyncOpenViking → SyncOpenViking.
Adds QueueStatus.total property for progress reporting.
Drops settle_count (unnecessary due to enqueue-before-report_success ordering).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nayagamez nayagamez force-pushed the feat/progress-callback branch from 77903b0 to 5e0fbd3 Compare February 14, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants