Skip to content

Commit

Permalink
feat(framework) Allow graceful exit of start_server via a single `C…
Browse files Browse the repository at this point in the history
…trl+C` (#4846)
  • Loading branch information
panh99 authored Jan 21, 2025
1 parent f5b3253 commit 2527881
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/py/flwr/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ def start_server( # pylint: disable=too-many-arguments,too-many-locals
"enabled" if certificates is not None else "disabled",
)

# Graceful shutdown
register_exit_handlers(
event_type=EventType.START_SERVER_LEAVE,
exit_message="Flower server terminated gracefully.",
grpc_servers=[grpc_server],
)

# Start training
hist = run_fl(
server=initialized_server,
Expand Down

0 comments on commit 2527881

Please sign in to comment.