Skip to content

Commit

Permalink
Add LegacyMessageType (#3064)
Browse files Browse the repository at this point in the history
  • Loading branch information
panh99 authored Mar 6, 2024
1 parent 5cd6dc8 commit 6da8079
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/py/flwr/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@


from .constant import MessageType as MessageType
from .constant import MessageTypeLegacy as MessageTypeLegacy
from .context import Context as Context
from .date import now as now
from .grpc import GRPC_MAX_MESSAGE_LENGTH
Expand Down Expand Up @@ -85,6 +86,7 @@
"log",
"Message",
"MessageType",
"MessageTypeLegacy",
"Metadata",
"Metrics",
"MetricsAggregationFn",
Expand Down
13 changes: 12 additions & 1 deletion src/py/flwr/common/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

MESSAGE_TYPE_GET_PROPERTIES = "get_properties"
MESSAGE_TYPE_GET_PARAMETERS = "get_parameters"
MESSAGE_TYPE_FIT = "fit"
MESSAGE_TYPE_FIT = "train"
MESSAGE_TYPE_EVALUATE = "evaluate"


Expand All @@ -53,6 +53,17 @@ def __new__(cls) -> MessageType:
raise TypeError(f"{cls.__name__} cannot be instantiated.")


class MessageTypeLegacy:
"""Legacy message type."""

GET_PROPERTIES = "get_properties"
GET_PARAMETERS = "get_parameters"

def __new__(cls) -> MessageTypeLegacy:
"""Prevent instantiation."""
raise TypeError(f"{cls.__name__} cannot be instantiated.")


class SType:
"""Serialisation type."""

Expand Down

0 comments on commit 6da8079

Please sign in to comment.