-
Notifications
You must be signed in to change notification settings - Fork 141
chore(weave): Add Annotation Queues Stats API #5781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Contributor
Author
This was referenced Nov 22, 2025
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=a59b3562eea1810133e02d5c00ac5a8d1f3d51ce |
4eaba5e to
fd18687
Compare
12d4f51 to
474142b
Compare
474142b to
18219c7
Compare
fd18687 to
157f8ae
Compare
157f8ae to
3a126f3
Compare
18219c7 to
49d3ccb
Compare
3a126f3 to
2f19dd7
Compare
49d3ccb to
3f0bd5a
Compare
2f19dd7 to
96e922c
Compare
a01e4fd to
ad4b3bf
Compare
96e922c to
ab97452
Compare
ad4b3bf to
a2cb043
Compare
ab97452 to
4cf94a1
Compare
4cf94a1 to
cc94bee
Compare
a2cb043 to
275496b
Compare
tssweeney
approved these changes
Jan 6, 2026
275496b to
fe9b43a
Compare
cc94bee to
53e74fc
Compare
fe9b43a to
fbd1db9
Compare
53e74fc to
64c046c
Compare
fbd1db9 to
edcc182
Compare
64c046c to
b054358
Compare
edcc182 to
a39069c
Compare
b054358 to
202982c
Compare
a39069c to
a1adb7f
Compare
459e8ce to
a99980c
Compare
a1adb7f to
dc13071
Compare
030b3c8 to
2da24b1
Compare
2da24b1 to
7678207
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Add Annotation Queues Stats API
This PR adds a new API endpoint to retrieve statistics for multiple annotation queues in a single batch request. This is needed for the Annotation Queues List page in the frontend to efficiently display progress information for all visible queues.
Motivation
The Annotation Queues List page displays queues in a paginated table with columns showing:
Without this API, the frontend would need to make individual requests for each queue or query all queue items separately, which is inefficient for paginated list views.
Changes
Backend (Python)
New API Interface (
trace_server_interface.py)AnnotationQueueStatsSchema: Schema for a single queue's statsqueue_id: The queue identifiertotal_items: Count of all items in the queuecompleted_items: Count of items marked as 'completed' or 'skipped'AnnotationQueuesStatsReq: Request with project_id and list of queue_idsAnnotationQueuesStatsRes: Response with list of statsQuery Builder (
annotation_queues_query_builder.py)make_queues_stats_query()function that generates an efficient SQL query using CTEs:total_items_per_queue: Counts items fromannotation_queue_itemstablecompleted_items_per_queue: Counts distinct queue_item_ids with 'completed' or 'skipped' status fromannotator_queue_items_progresstablearrayJoin()to ensure all requested queue_ids are in the result setClickHouse Implementation (
clickhouse_trace_server_batched.py)annotation_queues_stats()methodresult.result_rowsfor efficient result parsingServer Interface Implementations
sqlite_trace_server.py: Stub that raises NotImplementedError (annotation queues not supported in SQLite)external_to_internal_trace_server_adapter.py: Converts external project_id to internal format and delegatescaching_middleware_trace_server.py: Passthrough to next serverremote_http_trace_server.py: HTTP client implementation calling/annotation_queues/statscross_process_trace_server.py: IPC request handlerTests
Unit Tests (
test_client_annotations.py)Added three comprehensive test cases:
test_annotation_queues_stats- Main test with partial completion:test_annotation_queues_stats_empty_queues- Edge case for empty queues:test_annotation_queues_stats_no_queue_ids- Edge case for empty request:Test Implementation Details
client.server._next_trace_server.ch_clientc2hhd24vdGVzdC1wcm9qZWN0) for database queriesUPDATE table SET ... WHERE ...annotator_queue_items_progressrecordsAPI Usage
Request:
Performance Considerations