florist.api.launchers.local module¶
Launcher functions for local clients and servers.
- launch(server_constructor, server_address, n_server_rounds, clients, server_base_log_file_name='server', client_base_log_file_name='client')[source]¶
Launch an FL experiment.
First launches server than subsequently clients. Joins server process after clients are launched to block until FL is complete. (Server is last to finish executing).
- 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 clients (Sequence[BasicClient]): List of BasicClient instances to launch. server_base_log_file_name: (Optional[str]): The name used for the server log file. client_base_log_file_name: (Optional[str]): The base name used for the client log file.
_{i}.out appended to name to get final client log file name.
- launch_client(client, server_address, client_log_file_name)[source]¶
Spawn a process that starts FL client.
- Return type:
- 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_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.