Skip to content

Commit

Permalink
add module as metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
panh99 committed Sep 30, 2024
1 parent d121f60 commit fabbe7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/py/flwr/client/grpc_rere_client/grpc_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from flwr.common import log
from flwr.common.constant import (
GRPC_ADAPTER_METADATA_FLOWER_VERSION_KEY,
GRPC_ADAPTER_METADATA_GRPC_MESSAGE_MODULE_KEY,
GRPC_ADAPTER_METADATA_SHOULD_EXIT_KEY,
)
from flwr.common.version import package_version
Expand Down Expand Up @@ -62,8 +63,12 @@ def _send_and_receive(
self, request: GrpcMessage, response_type: type[T], **kwargs: Any
) -> T:
# Serialize request
msg_module = request.__class__.__module__
container_req = MessageContainer(
metadata={GRPC_ADAPTER_METADATA_FLOWER_VERSION_KEY: package_version},
metadata={
GRPC_ADAPTER_METADATA_FLOWER_VERSION_KEY: package_version,
GRPC_ADAPTER_METADATA_GRPC_MESSAGE_MODULE_KEY: msg_module,
},
grpc_message_name=request.__class__.__qualname__,
grpc_message_content=request.SerializeToString(),
)
Expand Down
1 change: 1 addition & 0 deletions src/py/flwr/common/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@

GRPC_ADAPTER_METADATA_FLOWER_VERSION_KEY = "flower-version"
GRPC_ADAPTER_METADATA_SHOULD_EXIT_KEY = "should-exit"
GRPC_ADAPTER_METADATA_GRPC_MESSAGE_MODULE_KEY = "grpc-message-module"


class MessageType:
Expand Down

0 comments on commit fabbe7d

Please sign in to comment.