Skip to content

Commit

Permalink
delete combiner models from minio by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Hellander committed Jan 29, 2024
1 parent fa9f0a0 commit a25afcb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/async-simulation/Experiment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 70,
"id": "f0380d35",
"metadata": {},
"outputs": [],
"source": [
"session_config_fedavg = {\n",
" \"helper\": \"numpyhelper\",\n",
" \"session_id\": \"experiment_fedavg17\",\n",
" \"session_id\": \"experiment_fedavg4\",\n",
" \"aggregator\": \"fedavg\",\n",
" \"model_id\": seed_model['model_id'],\n",
" \"rounds\": 10,\n",
" \"rounds\": 1,\n",
" }\n",
"\n",
"result_fedavg = client.start_session(**session_config_fedavg)"
Expand Down
8 changes: 7 additions & 1 deletion examples/async-simulation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ cd fedn/examples/async-simulation

Install FEDn and dependencies (we recommend using a virtual environment):

Standing in the folder 'fedn/fedn'

```
pip install -e .
```

From examples/async-simulation
```
pip install -e ../../fedn
pip install -r requirements.txt
```

Expand Down
3 changes: 2 additions & 1 deletion fedn/fedn/network/controller/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ def reduce(self, combiners):
model = load_model_from_BytesIO(data, helper)
meta["time_aggregate_model"] += time.time() - tic
i = i + 1
self.model_repository.delete_model(model_id)

self.model_repository.delete_model(model_id)

return model, meta

Expand Down
6 changes: 3 additions & 3 deletions fedn/fedn/network/storage/s3/miniorepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ def list_artifacts(self, bucket):
"Could not list models in bucket {}".format(bucket))
return objects

def delete_artifact(self, instance_name, bucket=[]):
def delete_artifact(self, instance_name, bucket):
""" Delete object with name instance_name from buckets.
:param instance_name: The object name
:param bucket: List of buckets to delete from
:type bucket: list
:param bucket: Buckets to delete from
:type bucket: str
"""

try:
Expand Down
2 changes: 1 addition & 1 deletion fedn/fedn/network/storage/s3/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def delete_model(self, model_id):
:type model_id: str
"""
try:
self.client.delete_artifact(model_id, bucket=[self.model_bucket])
self.client.delete_artifact(model_id, bucket=self.model_bucket)
except Exception:
logger.error("Failed to delete model {} repository.".format(model_id))
raise
Expand Down

0 comments on commit a25afcb

Please sign in to comment.