From 19b04feb73cbfac4cec00b4b02deb2fa6e96767f Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 17 Nov 2023 14:08:46 +0100 Subject: [PATCH] set session_id if empty earlier in start session process. --- fedn/fedn/network/api/interface.py | 3 ++- fedn/fedn/network/controller/controlbase.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fedn/fedn/network/api/interface.py b/fedn/fedn/network/api/interface.py index 0821ed176..e56462493 100644 --- a/fedn/fedn/network/api/interface.py +++ b/fedn/fedn/network/api/interface.py @@ -2,6 +2,7 @@ import copy import os import threading +import uuid from io import BytesIO from flask import jsonify, send_from_directory @@ -863,7 +864,7 @@ def start_session( # Setup session config session_config = { - "session_id": session_id, + "session_id": session_id if session_id else str(uuid.uuid4()), "round_timeout": round_timeout, "buffer_size": round_buffer_size, "model_id": model_id, diff --git a/fedn/fedn/network/controller/controlbase.py b/fedn/fedn/network/controller/controlbase.py index 08766b69b..fab6a2027 100644 --- a/fedn/fedn/network/controller/controlbase.py +++ b/fedn/fedn/network/controller/controlbase.py @@ -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"] if config["session_id"] else uuid.uuid4() + session_id = config["session_id"] self.tracer.create_session(id=session_id) self.tracer.set_session_config(session_id, config)