-
Notifications
You must be signed in to change notification settings - Fork 3
[feat] Provide fine-grained production & consumption status retrieval #8
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces fine-grained production and consumption status retrieval capabilities. Previously, the API only returned boolean values indicating whether all samples were produced/consumed. Now, the API returns tensors with per-sample status information, enabling users to retrieve detailed status for every individual sample.
Changes:
- Renamed ZMQ request types from
CHECK_CONSUMPTION/CHECK_PRODUCTIONtoGET_CONSUMPTION/GET_PRODUCTIONto reflect the new functionality - Modified
get_consumption_statusandget_production_status_for_fieldsmethods to return tuples of(global_index_tensor, status_tensor)instead of booleans - Added new client methods
async_get_consumption_statusandasync_get_production_statusthat return the fine-grained tensor data - Maintained backward compatibility by implementing
async_check_consumption_statusandasync_check_production_statusas wrappers that convert tensor results to booleans - Updated all tests to verify the new tensor-based return values
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| transfer_queue/utils/zmq_utils.py | Renamed enum values from CHECK_* to GET_* to reflect fine-grained retrieval |
| transfer_queue/controller.py | Modified status methods to return (global_index, status_tensor) tuples; updated request handling logic |
| transfer_queue/client.py | Added new async_get_* methods for fine-grained status retrieval and maintained backward compatibility with async_check_* methods |
| tests/test_controller_data_partitions.py | Updated tests to handle new tuple return values and added tests for mask parameter |
| tests/test_controller.py | Updated assertions to validate global_index and status tensors |
| tests/test_client.py | Added tests for new get_* methods and updated mock responses |
Comments suppressed due to low confidence (1)
transfer_queue/controller.py:520
- The return type annotation is incorrect. When
field_namesis None, empty, or a field is not found, the function returnsFalse(a boolean), but the function signature declares the return type astuple[Tensor, Tensor]. This will cause type checking failures. The early return statements on lines 515 and 520 should return(None, None)to match the declared return type.
if self.production_status is None or field_names is None or len(field_names) == 0:
return False
# Check if all requested fields are registered
for field_name in field_names:
if field_name not in self.field_name_mapping:
return False
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Background
In previous PR TransferQueue/TransferQueue#157, a coarse-grained status check was implemented.
Through the following APIs in
TransferQueueClient, a single boolean flag is returned to indicate whether all samples are produced or consumed.Changes
This PR introduces a fine-grained check mechanism. It provides the capability that allows users to retrieving the detailed production and consumption status of every individual sample.
CC @NINGBENZHE @walterchenchn