Skip to content

Commit

Permalink
Use api/v1 in APIClient start_session
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminastrand committed Nov 22, 2024
1 parent aa0ce51 commit 601b59c
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions fedn/network/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 601b59c

Please sign in to comment.