Skip to content

Commit

Permalink
if session id is None or empty guid should be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
niklastheman committed Nov 17, 2023
1 parent 735ba2d commit 2880e51
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions fedn/fedn/network/api/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import uuid

import requests

__all__ = ['APIClient']
Expand Down Expand Up @@ -137,9 +135,6 @@ def start_session(self, session_id=None, round_timeout=180, rounds=5, round_buff
:return: A dict with success or failure message and session config.
:rtype: dict
"""
# If session id is None, generate a random session id.
if session_id is None:
session_id = str(uuid.uuid4())
response = requests.post(self._get_url('start_session'), json={
'session_id': session_id,
'round_timeout': round_timeout,
Expand Down
2 changes: 1 addition & 1 deletion fedn/fedn/network/controller/controlbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def create_session(self, config):
session_id = uuid.uuid4()
config["session_id"] = str(session_id)
else:
session_id = config["session_id"]
session_id = config["session_id"] if config["session_id"] else uuid.uuid4()

self.tracer.create_session(id=session_id)
self.tracer.set_session_config(session_id, config)
Expand Down

0 comments on commit 2880e51

Please sign in to comment.