Skip to content

[client, storage] refactor: unify dynamic ZMQ socket decorator between simple_backend_manager and client#66

Merged
0oshowero0 merged 5 commits into
Ascend:mainfrom
ji-huazhong:refactor
Apr 27, 2026
Merged

[client, storage] refactor: unify dynamic ZMQ socket decorator between simple_backend_manager and client#66
0oshowero0 merged 5 commits into
Ascend:mainfrom
ji-huazhong:refactor

Conversation

@ji-huazhong
Copy link
Copy Markdown
Collaborator

as title.

@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

1 similar comment
@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@ji-huazhong ji-huazhong changed the title unify dynamic ZMQ socket decorator between simple_backend_manager and client [client, storage] refactor: unify dynamic ZMQ socket decorator between simple_backend_manager and client Mar 29, 2026
@0oshowero0 0oshowero0 requested a review from Copilot March 29, 2026 13:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors TransferQueue’s ZMQ request-socket lifecycle handling by introducing a shared async decorator in zmq_utils and reusing it in both the client and simple storage backend manager.

Changes:

  • Added dynamic_zmq_socket() utility decorator to centralize ZMQ context/socket creation, connect, injection, and cleanup.
  • Replaced AsyncTransferQueueClient.dynamic_socket() with a pre-bound module-level decorator using dynamic_zmq_socket().
  • Replaced AsyncSimpleStorageManager.dynamic_storage_manager_socket() with a pre-bound module-level decorator using dynamic_zmq_socket().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
transfer_queue/utils/zmq_utils.py Introduces shared dynamic_zmq_socket() decorator for async request sockets.
transfer_queue/storage/managers/simple_backend_manager.py Switches storage-unit request methods to use the shared decorator.
transfer_queue/client.py Switches controller request methods to use the shared decorator.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread transfer_queue/utils/zmq_utils.py Outdated
@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Comment thread transfer_queue/utils/zmq_utils.py Outdated
return socket


def dynamic_zmq_socket(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider

with_zmq_socket(
    "put_get_socket",
    get_identity=lambda self: self.storage_manager_id,
    get_peer=lambda self, target: self.storage_unit_infos[target],
    resolve_target=lambda args, kwargs: kwargs.get("target_storage_unit"),
    timeout=...,
)

… client

Signed-off-by: ji-huazhong <hzji210@gmail.com>
Signed-off-by: ji-huazhong <hzji210@gmail.com>
Signed-off-by: ji-huazhong <hzji210@gmail.com>
@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

1 similar comment
@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Signed-off-by: ji-huazhong <hzji210@gmail.com>
@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +51 to +55
# Pre-bound decorator for storage-unit socket operations.
with_storage_unit_socket = with_zmq_socket(
"put_get_socket",
get_identity=lambda self: self.storage_manager_id,
get_peer=lambda self, target: self.storage_unit_infos[target],
Comment thread transfer_queue/client.py
Comment on lines +53 to +57
# Pre-bound decorator for controller socket operations.
with_controller_socket = with_zmq_socket(
"request_handle_socket",
get_identity=lambda self: self.client_id,
get_peer=lambda self, target: self._controller,
Comment thread transfer_queue/utils/zmq_utils.py Outdated
Signed-off-by: ji-huazhong <hzji210@gmail.com>
@ascend-robot
Copy link
Copy Markdown

CLA Signature Pass

ji-huazhong, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@0oshowero0 0oshowero0 merged commit 961c5df into Ascend:main Apr 27, 2026
8 checks passed
@ji-huazhong ji-huazhong deleted the refactor branch April 27, 2026 07:30
ji-huazhong added a commit to ji-huazhong/TransferQueue that referenced this pull request Apr 27, 2026
…n simple_backend_manager and client (Ascend#66)

as title.

---------

Signed-off-by: ji-huazhong <hzji210@gmail.com>
ji-huazhong added a commit to ji-huazhong/TransferQueue that referenced this pull request Apr 27, 2026
…n simple_backend_manager and client (Ascend#66)

as title.

---------

Signed-off-by: ji-huazhong <hzji210@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants