[feat] Provide fine-grained production & consumption status retrieval#8
Merged
0oshowero0 merged 7 commits intoAscend:mainfrom Jan 23, 2026
Merged
[feat] Provide fine-grained production & consumption status retrieval#80oshowero0 merged 7 commits intoAscend:mainfrom
0oshowero0 merged 7 commits intoAscend:mainfrom
Conversation
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Signed-off-by: 0oshowero0 <o0shower0o@outlook.com>
Contributor
There was a problem hiding this comment.
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>
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.
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