florist.api.launchers.local module¶
Launcher functions for local clients and servers.
- launch_client(client, server_address, client_log_file_name)[source]¶
Spawn a process that starts FL client.
- Return type:
Process
- Args:
client (BasicClient): BasicClient instance to launch. server_address (str): String of <IP>:<PORT> to make server available. client_log_file_name: (Optional[str]): The name used for the client log file.
- launch_local_server(model, server_factory, server_config, server_address, n_clients, redis_address)[source]¶
Launch a FL server locally.
- Parameters:
model (
Module
) – (torch.nn.Model) The model object.server_factory (
ServerFactory
) – (ServerFactory) an instance of ServerFactory, which will be used to make a server for the model.server_config (
dict
[str
,Union
[bool
,bytes
,float
,int
,str
]]) – (dict[str, Any]) a dictionary with the necessary server configurations for the model.server_address (
str
) – (str) The address the server should start at.n_clients (
int
) – (int) The number of clients that will report to this server.redis_address (
str
) – (str) the address for the Redis instance for metrics reporting.
- Return type:
- Returns:
(tuple[str, multiprocessing.Process, str]) a tuple with: - The UUID of the server, which can be used to pull metrics from Redis. - The server’s local process object. - The local path for the log file.
- launch_server(server_constructor, server_address, n_server_rounds, server_log_file_name, seconds_to_sleep=10)[source]¶
Spawn a process that starts FL server.
- Args:
server_constructor (Callable[FlServer]): Callable that constructs FL server. server_address (str): String of <IP>:<PORT> to make server available. n_server_rounds (str): The number of rounds to perform FL. server_log_file_name (str): The name of the log file for the server. seconds_to_sleep (int): The number of seconds to sleep before launching server.
- Return type:
Process
- Returns:
Process: The process running the FL server.
- redirect_logging_from_console_to_file(log_file_path)[source]¶
Redirect loggers outputting to console to specified file.
- Return type:
- Args:
log_file_path (str): The path to the file to log to.
- start_client(client, server_address, client_log_file_name)[source]¶
Start client. Redirects logging to console, stdout and stderr to file.
- Return type:
- Args:
client (BasicClient): BasicClient instance to launch. server_address (str): String of <IP>:<PORT> where the server is available. client_log_file_name (str): The name of the client log file.
- start_server(server_constructor, server_address, n_server_rounds, server_log_file_name)[source]¶
Start server. Redirects logging to console, stdout and stderr to file.
- Return type:
- Args:
server_constructor (Callable[FlServer]): Callable that constructs FL server. server_address (str): String of <IP>:<PORT> to make server available. n_server_rounds (str): The number of rounds to perform FL server_log_file_name (str): The name of the server log file.