From 7a4b70f161e1e23142335526f80e519614cd94c6 Mon Sep 17 00:00:00 2001 From: Fredrik Wrede Date: Wed, 9 Oct 2024 15:18:53 +0000 Subject: [PATCH] fix --- fedn/network/api/interface.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/fedn/network/api/interface.py b/fedn/network/api/interface.py index bc3f0ee79..493fae8d6 100644 --- a/fedn/network/api/interface.py +++ b/fedn/network/api/interface.py @@ -600,18 +600,30 @@ def set_initial_model(self, file): :return: A json response with success or failure message. :rtype: :class:`flask.Response` """ + logger.info("Adding model") try: object = BytesIO() object.seek(0, 0) file.seek(0) object.write(file.read()) helper = self.control.get_helper() + logger.info(f"Loading model from file using helper {helper.name}") object.seek(0) model = helper.load(object) self.control.commit(file.filename, model) except Exception as e: + logger.error("Error occured during model loading") logger.debug(e) - return jsonify({"success": False, "message": "Failed to add initial model."}) + status_code = 400 + return ( + jsonify( + { + "success": False, + "message": "Failed to add model.", + } + ), + status_code, + ) return jsonify({"success": True, "message": "Initial model added successfully."})