flex.actors package
Submodules
flex.actors.actors module
Copyright (C) 2024 Instituto Andaluz Interuniversitario en Ciencia de Datos e Inteligencia Computacional (DaSCI).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
- class flex.actors.actors.FlexActors[source]
Bases:
OrderedDictClass that represents roles assigned to each node in a Federated Experiment. Roles are designed to restrict communications between nodes. It is important to note that Roles are not mutually exclusive, that is, a node can have multiple Roles.
- data(collections.OrderedDict)
with the node ids as keys and Roles as a value.
- Type:
The structure is a dictionary
- check_compatibility(key1: Hashable, key2: Hashable) bool[source]
Method to ensure that it is possible to establish communication between two actors, according to their roles. Note that the communication is stablished from node with key1 to node with key2. Communication from node with key2 to node with key1 is not checked.
Args:
key1 (Hashable): id used to identify a node. This node is supposed to start communication from itself to node with key2. key2 (Hashable): id used to identify a node. This node is suppored to receive communication from node with key1.
Returns:
bool: whether or not the communication is allowed.
flex.actors.architectures module
Copyright (C) 2024 Instituto Andaluz Interuniversitario en Ciencia de Datos e Inteligencia Computacional (DaSCI).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
- flex.actors.architectures.client_server_architecture(clients_ids: Iterable, server_id: str = 'server')[source]
Method to create a client-server architeture from an Iterable of clients ids given, and a server id (optional).
This method will assing to each id from the Iterable the client-role, and will create a new actor that will be the server-aggregator that will orchestrate the learning phase.
Args:
clients_ids (Iterable): List with the IDs for the clients server_id (str, optional): ID for the server actor. Defaults to None.
Returns:
FlexActors: The actors with their roles assigned.
- flex.actors.architectures.p2p_architecture(nodes_ids: list)[source]
Method to create a peer-to-peer (p2p) architecture from an Iterable of nodes given.
This method will assing all roles (client-aggregator-server) to every id from the Iterable, so each participant in the learning phase can act as client, aggregator and server.
Args:
clients_ids (Iterable): Iterable with the clients ids
Returns:
FlexActors: Actors with their role assigned.
flex.actors.role module
Copyright (C) 2024 Instituto Andaluz Interuniversitario en Ciencia de Datos e Inteligencia Computacional (DaSCI).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
- class flex.actors.role.FlexRole(value)[source]
Bases:
Enum- Enum which contains all possible roles:
Basic roles: client, server or aggregator
Composite roles: aggregator_client, server_client, server_aggregator, server_aggregator_client.
Note that composite roles are designed to represented a combination of Basic roles.
- aggregator = 2
- aggregator_client = 4
- client = 1
- server = 3
- server_aggregator = 6
- server_aggregator_client = 7
- server_client = 5
flex.actors.role_manager module
Copyright (C) 2024 Instituto Andaluz Interuniversitario en Ciencia de Datos e Inteligencia Computacional (DaSCI).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
- class flex.actors.role_manager.FlexRoleManager[source]
Bases:
objectClass used to check allowed communications between different roles.
- aggregator_allowed_comm = {FlexRole.aggregator, FlexRole.aggregator_client, FlexRole.server, FlexRole.server_aggregator, FlexRole.server_aggregator_client, FlexRole.server_client}
- aggregator_wannabe = {FlexRole.aggregator, FlexRole.aggregator_client, FlexRole.server_aggregator, FlexRole.server_aggregator_client}
- classmethod can_comm_with_aggregator(role: FlexRole) bool[source]
Method to ensure that role can establish a communication with an aggregator role.
Args:
role (Role): role to be checked
Returns:
bool: whether or not role can communicate with a aggregator role
- classmethod can_comm_with_client(role: FlexRole) bool[source]
Method to ensure that role can establish a communication with a client role.
Args:
role (Role): role to be checked
Returns:
bool: whether or not role can communicate with a client role
- classmethod can_comm_with_server(role: FlexRole) bool[source]
Method to ensure that role can establish a communication with a server role.
Args:
role (Role): role to be checked
Returns:
bool: whether or not role can communicate with a server role
- classmethod check_compatibility(role1: FlexRole, role2: FlexRole) bool[source]
Method used to ensure that it is possible to communicate from role1 to role2, note that the communication from role2 to role1 is not checked.
Args:
role1 (Role): role which establishes communication with role2 role2 (Role): role which receives communication from role1
Returns:
bool: whether or not the communication from role1 to role2 is allowed.
- client_allowed_comm = {FlexRole.aggregator, FlexRole.aggregator_client, FlexRole.server_aggregator, FlexRole.server_aggregator_client}
- client_wannabe = {FlexRole.aggregator_client, FlexRole.client, FlexRole.server_aggregator_client, FlexRole.server_client}
- classmethod is_aggregator(role: FlexRole) bool[source]
Method to check whether a role is an aggregator role.
Args:
role (Role): role to be checked
Returns:
bool: wheter the not role is an aggregator role
- classmethod is_client(role: FlexRole) bool[source]
Method to check whether a role is a client role.
Args:
role (Role): role to be checked
Returns:
bool: wheter the not role is a client role
- classmethod is_server(role: FlexRole) bool[source]
Method to check whether a role is a server role.
Args:
role (Role): role to be checked
Returns:
bool: wheter the not role is a server role
- server_allowed_comm = {FlexRole.aggregator_client, FlexRole.client, FlexRole.server_aggregator, FlexRole.server_aggregator_client, FlexRole.server_client}
- server_wannabe = {FlexRole.server, FlexRole.server_aggregator, FlexRole.server_aggregator_client, FlexRole.server_client}
Module contents
Copyright (C) 2024 Instituto Andaluz Interuniversitario en Ciencia de Datos e Inteligencia Computacional (DaSCI)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.