fl_server_ai.notification ¶
Modules:
| Name | Description |
|---|---|
notification | |
notification_type | |
serializable | |
training | |
Classes:
| Name | Description |
|---|---|
Notification | Abstract base class for notifications. |
NotificationType | Notification types including a short description for each type. |
TrainingFinishedNotification | Notification that a training has finished. |
TrainingRoundStartNotification | Notification for the start of a training round. |
Attributes¶
__all__ module-attribute ¶
__all__ = ['NotificationType', 'Notification', 'TrainingRoundStartNotification', 'TrainingFinishedNotification']
Classes¶
Notification dataclass ¶
Bases: Generic[TBody], Serializable
flowchart TD
fl_server_ai.notification.Notification[Notification]
fl_server_ai.notification.serializable.Serializable[Serializable]
fl_server_ai.notification.serializable.Serializable --> fl_server_ai.notification.Notification
click fl_server_ai.notification.Notification href "" "fl_server_ai.notification.Notification"
click fl_server_ai.notification.serializable.Serializable href "" "fl_server_ai.notification.serializable.Serializable"
Abstract base class for notifications.
- API Reference
fl_server_ainotificationtraining
- API Reference
fl_server_ainotificationnotification Functionssend_notifications
Classes:
| Name | Description |
|---|---|
Body | Inner class for the body of the notification. |
Methods:
| Name | Description |
|---|---|
__init__ | |
send | Send notification to the receivers asynchronously. |
serialize | Serialize the notification into a dictionary. |
Attributes:
| Name | Type | Description |
|---|---|---|
body | TBody | The body of the notification. |
callback_error | Signature | None | The callback to be called on error. By default, this is None. |
callback_success | Signature | None | The callback to be called on success. By default, this is None. |
receivers | list[NotificationReceiver] | The receivers of the notification. |
type | NotificationType | The type of the notification. |
Source code in fl_server_ai/notification/notification.py
Attributes¶
callback_error property ¶
The callback to be called on error. By default, this is None.
Returns:
| Type | Description |
|---|---|
Signature | None | Optional[Signature]: The callback to be called on error, or None if no such callback is set. |
callback_success property ¶
The callback to be called on success. By default, this is None.
Returns:
| Type | Description |
|---|---|
Signature | None | Optional[Signature]: The callback to be called on success, or None if no such callback is set. |
receivers instance-attribute ¶
receivers: list[NotificationReceiver]
The receivers of the notification.
type class-attribute instance-attribute ¶
type: NotificationType = field(init=False)
The type of the notification.
Classes¶
Body dataclass ¶
Bases: Serializable
flowchart TD
fl_server_ai.notification.Notification.Body[Body]
fl_server_ai.notification.serializable.Serializable[Serializable]
fl_server_ai.notification.serializable.Serializable --> fl_server_ai.notification.Notification.Body
click fl_server_ai.notification.Notification.Body href "" "fl_server_ai.notification.Notification.Body"
click fl_server_ai.notification.serializable.Serializable href "" "fl_server_ai.notification.serializable.Serializable"
Inner class for the body of the notification.
Methods:
| Name | Description |
|---|---|
__init__ | |
Source code in fl_server_ai/notification/notification.py
Functions¶
send ¶
send(callback_success: Signature | None = None, callback_error: Signature | None = None) -> AsyncResult
Send notification to the receivers asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Signature | None | The callback to be called on success. Defaults to None. | None |
| Signature | None | The callback to be called on error. Defaults to None. | None |
Returns:
| Name | Type | Description |
|---|---|---|
AsyncResult | AsyncResult | The result of the asynchronous operation. |
Source code in fl_server_ai/notification/notification.py
NotificationType ¶
Bases: Enum
flowchart TD
fl_server_ai.notification.NotificationType[NotificationType]
click fl_server_ai.notification.NotificationType href "" "fl_server_ai.notification.NotificationType"
Notification types including a short description for each type.
- API Reference
fl_server_ainotification-
training-
finished ClassesTrainingFinishedNotification Attributestype -
model_test ClassesTrainingModelTestNotification Attributestype -
round_start ClassesTrainingRoundStartNotification Attributestype -
start ClassesTrainingStartNotification Attributestype -
swag ClassesTrainingSWAGRoundStartNotification Attributestype -
training Classes
-
-
notification Classes -
notification ClassesNotification Attributestype
-
Methods:
| Name | Description |
|---|---|
__init__ | Initialize the enum member. |
__new__ | Override the |
Attributes:
| Name | Type | Description |
|---|---|---|
CLIENT_REMOVED | | |
MODEL_TEST_ROUND | | |
SWAG_ROUND_START | | |
TRAINING_FINISHED | | |
TRAINING_START | | |
UPDATE_ROUND_START | | |
description | Property to get the description of the enum member. |
Source code in fl_server_ai/notification/notification_type.py
Attributes¶
CLIENT_REMOVED class-attribute instance-attribute ¶
MODEL_TEST_ROUND class-attribute instance-attribute ¶
- API Reference
fl_server_ainotificationtraining
SWAG_ROUND_START class-attribute instance-attribute ¶
- API Reference
fl_server_ainotificationtraining
TRAINING_FINISHED class-attribute instance-attribute ¶
- API Reference
fl_server_ainotification
TRAINING_START class-attribute instance-attribute ¶
- API Reference
fl_server_ainotificationtraining
UPDATE_ROUND_START class-attribute instance-attribute ¶
- API Reference
fl_server_ainotification
description property ¶
Property to get the description of the enum member.
Returns:
| Name | Type | Description |
|---|---|---|
str | The description of the enum member. |
Functions¶
__init__ ¶
__init__(_: str, description: str | None = None)
Initialize the enum member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| str | The value of the enum member. Ignored in this method as it's already set by new. | required |
| str | None | The description of the enum member. Defaults to None. | None |
Source code in fl_server_ai/notification/notification_type.py
__new__ ¶
Override the __new__ method to set the value of the enum member.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Variable length argument list where the first value is the value of the enum member. | () | |
| Arbitrary keyword arguments. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
object | New instance of the class. |
Source code in fl_server_ai/notification/notification_type.py
TrainingFinishedNotification dataclass ¶
Bases: TrainingNotification['TrainingFinishedNotification.Body']
flowchart TD
fl_server_ai.notification.TrainingFinishedNotification[TrainingFinishedNotification]
fl_server_ai.notification.training.training.TrainingNotification[TrainingNotification]
fl_server_ai.notification.notification.Notification[Notification]
fl_server_ai.notification.serializable.Serializable[Serializable]
fl_server_ai.notification.training.training.TrainingNotification --> fl_server_ai.notification.TrainingFinishedNotification
fl_server_ai.notification.notification.Notification --> fl_server_ai.notification.training.training.TrainingNotification
fl_server_ai.notification.serializable.Serializable --> fl_server_ai.notification.notification.Notification
click fl_server_ai.notification.TrainingFinishedNotification href "" "fl_server_ai.notification.TrainingFinishedNotification"
click fl_server_ai.notification.training.training.TrainingNotification href "" "fl_server_ai.notification.training.training.TrainingNotification"
click fl_server_ai.notification.notification.Notification href "" "fl_server_ai.notification.notification.Notification"
click fl_server_ai.notification.serializable.Serializable href "" "fl_server_ai.notification.serializable.Serializable"
Notification that a training has finished.
Classes:
| Name | Description |
|---|---|
Body | Inner class representing the body of the notification. |
Methods:
| Name | Description |
|---|---|
from_training | Create a |
Attributes:
| Name | Type | Description |
|---|---|---|
type | NotificationType | The type of the notification. |
Source code in fl_server_ai/notification/training/finished.py
Attributes¶
type class-attribute instance-attribute ¶
type: NotificationType = TRAINING_FINISHED
The type of the notification.
Classes¶
Body dataclass ¶
Bases: Serializable
flowchart TD
fl_server_ai.notification.TrainingFinishedNotification.Body[Body]
fl_server_ai.notification.serializable.Serializable[Serializable]
fl_server_ai.notification.serializable.Serializable --> fl_server_ai.notification.TrainingFinishedNotification.Body
click fl_server_ai.notification.TrainingFinishedNotification.Body href "" "fl_server_ai.notification.TrainingFinishedNotification.Body"
click fl_server_ai.notification.serializable.Serializable href "" "fl_server_ai.notification.serializable.Serializable"
Inner class representing the body of the notification.
Methods:
| Name | Description |
|---|---|
__init__ | |
Attributes:
| Name | Type | Description |
|---|---|---|
global_model_uuid | UUID | The UUID of the global model. |
Source code in fl_server_ai/notification/training/finished.py
Functions¶
from_training classmethod ¶
Create a TrainingFinishedNotification instance from a training object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Training | The training object to create the notification from. | required |
Returns:
| Name | Type | Description |
|---|---|---|
TrainingFinishedNotification | The created notification. |
Source code in fl_server_ai/notification/training/finished.py
TrainingRoundStartNotification dataclass ¶
Bases: TrainingNotification['TrainingRoundStartNotification.Body']
flowchart TD
fl_server_ai.notification.TrainingRoundStartNotification[TrainingRoundStartNotification]
fl_server_ai.notification.training.training.TrainingNotification[TrainingNotification]
fl_server_ai.notification.notification.Notification[Notification]
fl_server_ai.notification.serializable.Serializable[Serializable]
fl_server_ai.notification.training.training.TrainingNotification --> fl_server_ai.notification.TrainingRoundStartNotification
fl_server_ai.notification.notification.Notification --> fl_server_ai.notification.training.training.TrainingNotification
fl_server_ai.notification.serializable.Serializable --> fl_server_ai.notification.notification.Notification
click fl_server_ai.notification.TrainingRoundStartNotification href "" "fl_server_ai.notification.TrainingRoundStartNotification"
click fl_server_ai.notification.training.training.TrainingNotification href "" "fl_server_ai.notification.training.training.TrainingNotification"
click fl_server_ai.notification.notification.Notification href "" "fl_server_ai.notification.notification.Notification"
click fl_server_ai.notification.serializable.Serializable href "" "fl_server_ai.notification.serializable.Serializable"
Notification for the start of a training round.
- API Reference
fl_server_ainotificationtraining
Classes:
| Name | Description |
|---|---|
Body | Inner class representing the body of the notification. |
Methods:
| Name | Description |
|---|---|
from_training | Create a |
Attributes:
| Name | Type | Description |
|---|---|---|
callback_error | Signature | None | |
callback_success | Signature | None | |
type | NotificationType | The type of the notification. |
Source code in fl_server_ai/notification/training/round_start.py
Attributes¶
type class-attribute instance-attribute ¶
type: NotificationType = UPDATE_ROUND_START
The type of the notification.
Classes¶
Body dataclass ¶
Bases: Serializable
flowchart TD
fl_server_ai.notification.TrainingRoundStartNotification.Body[Body]
fl_server_ai.notification.serializable.Serializable[Serializable]
fl_server_ai.notification.serializable.Serializable --> fl_server_ai.notification.TrainingRoundStartNotification.Body
click fl_server_ai.notification.TrainingRoundStartNotification.Body href "" "fl_server_ai.notification.TrainingRoundStartNotification.Body"
click fl_server_ai.notification.serializable.Serializable href "" "fl_server_ai.notification.serializable.Serializable"
Inner class representing the body of the notification.
Methods:
| Name | Description |
|---|---|
__init__ | |
Attributes:
| Name | Type | Description |
|---|---|---|
global_model_uuid | UUID | The UUID of the global model. |
round | int | The round number. |
Source code in fl_server_ai/notification/training/round_start.py
Functions¶
from_training classmethod ¶
Create a TrainingRoundStartNotification instance from a training object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| Training | The training object to create the notification from. | required |
Returns:
| Name | Type | Description |
|---|---|---|
TrainingRoundStartNotification | The created notification. |