Skip to content

Commit

Permalink
Bug/SK-938 | Fix KeyError for client_id (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrede authored Jul 11, 2024
1 parent 5af54fc commit d0a5c02
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-containers.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "build containers"

on:
workflow_dispatch:
push:
branches:
- master
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/push-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Publish Python distribution to PyPI

on:
workflow_dispatch:
release:
types: [created]
types: published

jobs:
build-and-publish:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
author = "Scaleout Systems AB"

# The full version, including alpha/beta/rc tags
release = "0.11.0"
release = "0.11.1"

# Add any Sphinx extension module names here, as strings
extensions = [
Expand Down
8 changes: 7 additions & 1 deletion fedn/network/storage/statestore/mongostatestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,13 @@ def set_client(self, client_data):
:return:
"""
client_data["updated_at"] = str(datetime.now())
self.clients.update_one({"client_id": client_data["client_id"]}, {"$set": client_data}, True)
try:
self.clients.update_one({"client_id": client_data["client_id"]}, {"$set": client_data}, True)
except KeyError:
# If client_id is not present, use name as identifier, for backwards compatibility
id = str(uuid.uuid4())
client_data["client_id"] = id
self.clients.update_one({"name": client_data["name"]}, {"$set": client_data}, True)

def get_client(self, client_id):
"""Get client by client_id.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "fedn"
version = "0.11.0"
version = "0.11.1"
description = "Scaleout Federated Learning"
authors = [{ name = "Scaleout Systems AB", email = "[email protected]" }]
readme = "README.rst"
Expand Down

0 comments on commit d0a5c02

Please sign in to comment.