adap/flower

Dynamic timeout settings

Opened this issue · 2 comments

Describe the type of feature and its functionality.

Various timeout scenarios arise during the federated learning process.
Therefore, dynamically allowing each round to have different timeout would be a significant improvement.

Describe step by step what files and adjustments are you planning to include.

When starting a server using the function "flwr.server.start_server", the config can be set with a round_timeout value.
However, this timeout value is fixed for all rounds needed to be performed.
For example, there are 10 rounds, if the timeout is 20 seconds, each of the 10 rounds will end if 20 seconds are passed.
Can I dynamically set the timeout for each round, such as 20 seconds for the 1st round, 39 seconds for the 2nd round, etc.?

I revised the codes in "server.py", by changing the parameters passed to the function "fit(self, num_rounds: int, timeout: Optional[float]) -> Tuple[History, float]".
Specifically, I pass the "config" to the function rather than the fixed "timeout" (timeout = config.round_timeout).
Therefore, the timeout is set for each round, according to the "config".

Because the "config" can be easily adjusted, the timeout can be adjusted dynamically.
For example, in the following codes, I can dynamically change the "round_timeout" value for "server_config".
If the timeout is set with "config.round_timeout", it also can have different timeout for different rounds.

client_manager = SimpleClientManager()
server = Server(client_manager=client_manager, strategy=strategy)
server_config = fl.server.ServerConfig(num_rounds=num_rounds, round_timeout=60)
fl.server.start_server(server=server, config=server_config)

However, it introduced some connection problems, and the clients will exist when timeout occurs.

Therefore, I hope you can consider this feature and implement it well.

Is there something else you want to add?

No response

Hi @jmsw4bn , I just wonder about the round_timeout config. From what I understand, if we have 10 rounds, and the round_timeout is 20, it means that the server will wait for the clients in 20 seconds for each round, right?

Hi @jmsw4bn , I just wonder about the round_timeout config. From what I understand, if we have 10 rounds, and the round_timeout is 20, it means that the server will wait for the clients in 20 seconds for each round, right?

Yes, the round_timeout is the same for each round.