From 601b59cc8bcabb61ba17d7ce10e4264ac0ee16cb Mon Sep 17 00:00:00 2001 From: benjaminastrand Date: Fri, 22 Nov 2024 15:12:32 +0100 Subject: [PATCH] Use api/v1 in APIClient start_session --- fedn/network/api/client.py | 39 +++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/fedn/network/api/client.py b/fedn/network/api/client.py index ab3e2e07d..180c654f9 100644 --- a/fedn/network/api/client.py +++ b/fedn/network/api/client.py @@ -607,26 +607,39 @@ def start_session( :rtype: dict """ response = requests.post( - self._get_url("start_session"), + self._get_url_api_v1("sessions"), json={ "session_id": id, - "aggregator": aggregator, - "aggregator_kwargs": aggregator_kwargs, - "model_id": model_id, - "round_timeout": round_timeout, - "rounds": rounds, - "round_buffer_size": round_buffer_size, - "delete_models": delete_models, - "validate": validate, - "helper": helper, - "min_clients": min_clients, - "requested_clients": requested_clients, - "server_functions": None if server_functions is None else inspect.getsource(server_functions), + "session_config": { + "aggregator": aggregator, + "aggregator_kwargs": aggregator_kwargs, + "round_timeout": round_timeout, + "buffer_size": round_buffer_size, + "model_id": model_id, + "delete_models_storage": delete_models, + "clients_required": min_clients, + "requested_clients": requested_clients, + "validate": validate, + "helper_type": helper, + "server_functions": None if server_functions is None else inspect.getsource(server_functions), + }, }, verify=self.verify, headers=self.headers, ) + if response.status_code == 201: + response = requests.post( + self._get_url_api_v1("sessions/start"), + json={ + "session_id": id, + "rounds": rounds, + "round_timeout": round_timeout, + }, + verify=self.verify, + headers=self.headers, + ) + _json = response.json() return _json