Repository navigation
merge with 0912 - #7
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the transfer queue codebase by consolidating utility classes and adding new serialization functionality:
- Moves common enum classes (
ExplicitEnum,TransferQueueRole) fromzmq_utils.pyto a newutils.pymodule for better organization - Adds new ZMQ request types and removes some obsolete ones related to prompt metadata
- Introduces a comprehensive serialization module (
serial_utils.py) with msgpack encoding/decoding for torch tensors and tensordict objects
Reviewed Changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| transfer_queue/utils/zmq_utils.py | Refactored to import common enums from utils module, added CLEAR_DATA operations, removed prompt metadata operations and IP utility function |
| transfer_queue/utils/utils.py | New utility module containing shared enum classes and a tensor sampling function |
| transfer_queue/utils/serial_utils.py | New serialization module with msgpack encoding/decoding for torch tensors and tensordict objects |
| transfer_queue/init.py | Updated imports to remove zmq-specific exports and add AsyncTransferQueueClient |
| tests/test_serial_utils_on_cpu.py | Comprehensive test suite for the new serialization functionality |
| recipe/simple_use_case/sync_demo.py | Demo script showing synchronous usage of the transfer queue system |
| recipe/simple_use_case/async_demo.py | Demo script showing asynchronous usage with Ray actors |
| pyproject.toml | Updated mypy configuration to include new module paths |
Comments suppressed due to low confidence (1)
transfer_queue/utils/zmq_utils.py:120
- The
list.append()method returnsNone, soresult = result.append(...)will assignNonetoresult. This should beresult.append(pickle.loads(d))without the assignment.
result = result.append(pickle.loads(d))
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| NOT_PRODUCED = 0 | ||
| READY_FOR_CONSUME = 1 | ||
| CONSUMED = 2 |
There was a problem hiding this comment.
The ProductionStatus enum inherits from ExplicitEnum(str, Enum) but assigns integer values instead of string values. This will cause type inconsistency since the enum is expected to be string-based.
| NOT_PRODUCED = 0 | |
| READY_FOR_CONSUME = 1 | |
| CONSUMED = 2 | |
| NOT_PRODUCED = "0" | |
| READY_FOR_CONSUME = "1" | |
| CONSUMED = "2" |
| ready_for_consume_idx: list[int], | ||
| batch_size: int, | ||
| get_n_samples: bool, | ||
| n_samples_per_prompt: int, | ||
| ) -> Optional[list[int]]: |
There was a problem hiding this comment.
[nitpick] Using list[int] syntax requires Python 3.9+. For better compatibility, consider using List[int] from the typing module, which is already imported.
| ready_for_consume_idx: list[int], | |
| batch_size: int, | |
| get_n_samples: bool, | |
| n_samples_per_prompt: int, | |
| ) -> Optional[list[int]]: | |
| ready_for_consume_idx: List[int], | |
| batch_size: int, | |
| get_n_samples: bool, | |
| n_samples_per_prompt: int, | |
| ) -> Optional[List[int]]: |
| ready_for_consume_idx: list[int], | ||
| batch_size: int, | ||
| get_n_samples: bool, | ||
| n_samples_per_prompt: int, | ||
| ) -> Optional[list[int]]: |
There was a problem hiding this comment.
[nitpick] Using list[int] syntax requires Python 3.9+. For better compatibility, consider using List[int] from the typing module, which is already imported.
| ready_for_consume_idx: list[int], | |
| batch_size: int, | |
| get_n_samples: bool, | |
| n_samples_per_prompt: int, | |
| ) -> Optional[list[int]]: | |
| ready_for_consume_idx: List[int], | |
| batch_size: int, | |
| get_n_samples: bool, | |
| n_samples_per_prompt: int, | |
| ) -> Optional[List[int]]: |
…impleStorageManager (#7) * feat: update tests for SimpleStorageUnit and add new tests for AsyncSimpleStorageManager Signed-off-by: jianjunzhong <[email protected]> * refactor: simplify mock operations and adjust performance test parameters for faster execution Signed-off-by: jianjunzhong <[email protected]> --------- Signed-off-by: jianjunzhong <[email protected]>
No description provided.