ServerApp#
- class ServerApp(server: Server | None = None, config: ServerConfig | None = None, strategy: Strategy | None = None, client_manager: ClientManager | None = None)[source]#
Bases :
object
Flower ServerApp.
Exemples
Use the ServerApp with an existing Strategy:
>>> server_config = ServerConfig(num_rounds=3) >>> strategy = FedAvg() >>> >>> app = ServerApp() >>> server_config=server_config, >>> strategy=strategy, >>> )
Use the ServerApp with a custom main function:
>>> app = ServerApp() >>> >>> @app.main() >>> def main(driver: Driver, context: Context) -> None: >>> print("ServerApp running")
Methods
main
()Return a decorator that registers the main fn with the server app.
- main() Callable[[Callable[[Driver, Context], None]], Callable[[Driver, Context], None]] [source]#
Return a decorator that registers the main fn with the server app.
Exemples
>>> app = ServerApp() >>> >>> @app.main() >>> def main(driver: Driver, context: Context) -> None: >>> print("ServerApp running")