Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/SK-687 | Fedn API v1 #532

Merged
merged 70 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
9f9baeb
Added new v1 module to api
niklastheman Feb 13, 2024
e6f86d9
Added repositories module containing a parent repository and a status…
niklastheman Feb 13, 2024
86ce1d4
repository list method implemented
niklastheman Feb 13, 2024
dc8b447
model routes added
niklastheman Feb 13, 2024
ee68139
Merge branch 'master' into feature/SK-687
niklastheman Feb 15, 2024
b7f5205
validations added to api
niklastheman Feb 15, 2024
eadb3d9
clients routes added + get list of documents no can handle skip and l…
niklastheman Feb 15, 2024
4fdad05
added package routes including /active to get active package
niklastheman Feb 15, 2024
722f91f
added session routes
niklastheman Feb 15, 2024
e4a0d0d
combiners routes added to api
niklastheman Feb 15, 2024
cf3c9b8
remove typing option from combiners routes
niklastheman Feb 15, 2024
2b55a25
rounds added to api
niklastheman Feb 15, 2024
35c4bf9
model routes, get by model or id
niklastheman Feb 15, 2024
116bfbc
client routes need no typing
niklastheman Feb 15, 2024
00ff7c0
package routes fixes
niklastheman Feb 15, 2024
24b254f
typing changes for statuses and validations
niklastheman Feb 15, 2024
d607734
get combiner by id or name
niklastheman Feb 15, 2024
b0fcb76
models repository typings fix
niklastheman Feb 15, 2024
422aded
fixes
niklastheman Feb 15, 2024
051e5a2
get session, fixed typing
niklastheman Feb 15, 2024
21204c3
descendants added to models
niklastheman Feb 15, 2024
aac691e
ancestors added to models
niklastheman Feb 15, 2024
20c103e
fix model ancestors
niklastheman Feb 16, 2024
958fe89
Added count (get/post) and /list (post) for clients
niklastheman Feb 16, 2024
f7ff9a6
Added count (get/post) and /list (post) for combiners
niklastheman Feb 16, 2024
5437675
Added count (get/post) and /list (post) for models
niklastheman Feb 16, 2024
d4bd7f2
Added count (get/post) and /list (post) for rounds
niklastheman Feb 16, 2024
6e6d7d5
Added count (get/post) and /list (post) for sessions
niklastheman Feb 16, 2024
565af41
Added count (get/post) and /list (post) for statuses
niklastheman Feb 16, 2024
ddc5d0b
Added count (get/post) and /list (post) for validations
niklastheman Feb 16, 2024
c063324
added doc strings to get and list clients
niklastheman Feb 16, 2024
2b1e1fe
added flasgger
niklastheman Feb 19, 2024
900735d
Added Swagger docs for client routs
niklastheman Feb 19, 2024
751f5b4
Added Swagger docs for combiner routes
niklastheman Feb 19, 2024
49474ca
EntityNotFound exception added and used in client, combiner and model…
niklastheman Feb 20, 2024
5a7e6c7
model descendants & ancestors - limit defaults to 10
niklastheman Feb 20, 2024
a2e54d1
documentation added for packages routes
niklastheman Feb 20, 2024
6b9cd51
Added documentation for round routes
niklastheman Feb 21, 2024
feb2f03
Added documentation for session routes
niklastheman Feb 21, 2024
a1fb313
Entity not found added to sessions repository
niklastheman Feb 21, 2024
3e0e494
Added documentation for status routes
niklastheman Feb 21, 2024
8f86fb5
Added documentation for validation routes
niklastheman Feb 21, 2024
00f3ac3
Swagger - display FEDn api
niklastheman Feb 21, 2024
256de93
fix formatting for repositories
niklastheman Feb 21, 2024
393427c
Added doc string to repository
niklastheman Feb 21, 2024
1338055
Added doc string to repositories
niklastheman Feb 21, 2024
ecc2a27
renamed repositories to stores
niklastheman Feb 26, 2024
76e7ef8
removed flasgger
niklastheman Feb 27, 2024
dd8615d
Merge branch 'master' into feature/SK-687
niklastheman Feb 27, 2024
fa04433
changed name of store variables
niklastheman Feb 28, 2024
09da923
removed new endpoints (find integration test failure)
niklastheman Feb 28, 2024
7bdc819
added client routes
niklastheman Feb 28, 2024
36540e9
trying to solve integration tests
niklastheman Feb 28, 2024
067843a
test to fix integration test
niklastheman Feb 28, 2024
6204c51
removed false init
niklastheman Feb 28, 2024
de4dc9e
removed blueprints
niklastheman Feb 28, 2024
8ac4385
no relative imports
niklastheman Feb 28, 2024
dc186a3
test sync issues
niklastheman Feb 28, 2024
1d7ed22
try again
niklastheman Feb 28, 2024
77c3fc4
remove dashboard
Wrede Feb 28, 2024
127bd72
test
Wrede Feb 28, 2024
6c7031a
remove python 3.8 from matrix
Wrede Feb 28, 2024
b6ab070
Removed modern python syntax
niklastheman Feb 28, 2024
0cf7fe2
fix
Wrede Feb 28, 2024
6464cb2
Merge branch 'feature/SK-687' of github.com:scaleoutsystems/fedn into…
Wrede Feb 28, 2024
cbd4f6b
added python 3.8 to integration tests
niklastheman Feb 28, 2024
ed8229e
added Swagger
niklastheman Feb 28, 2024
18d13d0
revert tests to previous version
niklastheman Feb 28, 2024
6e7f6cb
isort fix
niklastheman Feb 28, 2024
a2992db
Repository comments => Store comments
niklastheman Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .ci/tests/examples/print_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ docker logs "$(basename $PWD)_minio_1"
echo "Mongo logs"
docker logs "$(basename $PWD)_mongo_1"

echo "Dashboard logs"
docker logs "$(basename $PWD)_dashboard_1"

echo "API-Server logs"
docker logs "$(basename $PWD)_api-server_1"

Expand Down
1 change: 1 addition & 0 deletions .ci/tests/examples/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ helper="$2"

>&2 echo "Start FEDn"
pushd "examples/$example"

docker-compose \
-f ../../docker-compose.yaml \
-f docker-compose.override.yaml \
Expand Down
61 changes: 44 additions & 17 deletions fedn/fedn/network/api/server.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,47 @@
from flasgger import Swagger
from flask import Flask, jsonify, request

from fedn.common.config import (get_controller_config, get_modelstorage_config,
get_network_config, get_statestore_config)
from fedn.network.api.interface import API
from fedn.network.api.v1.client_routes import bp as client_bp
from fedn.network.api.v1.combiner_routes import bp as combiner_bp
from fedn.network.api.v1.model_routes import bp as model_bp
from fedn.network.api.v1.package_routes import bp as package_bp
from fedn.network.api.v1.round_routes import bp as round_bp
from fedn.network.api.v1.session_routes import bp as session_bp
from fedn.network.api.v1.status_routes import bp as status_bp
from fedn.network.api.v1.validation_routes import bp as validation_bp
from fedn.network.controller.control import Control
from fedn.network.storage.statestore.mongostatestore import MongoStateStore

statestore_config = get_statestore_config()
network_id = get_network_config()
modelstorage_config = get_modelstorage_config()
statestore = MongoStateStore(
network_id, statestore_config["mongo_config"]
)
statestore = MongoStateStore(network_id, statestore_config["mongo_config"])
statestore.set_storage_backend(modelstorage_config)
control = Control(statestore=statestore)
api = API(statestore, control)
app = Flask(__name__)
app.register_blueprint(client_bp)
app.register_blueprint(status_bp)
app.register_blueprint(model_bp)
app.register_blueprint(validation_bp)
app.register_blueprint(package_bp)
app.register_blueprint(session_bp)
app.register_blueprint(combiner_bp)
app.register_blueprint(round_bp)

template = {
"swagger": "2.0",
"info": {
"title": "FEDn API",
"description": "API for the FEDn network.",
"version": "0.0.1"
}
}

swagger = Swagger(app, template=template)


@app.route("/get_model_trail", methods=["GET"])
Expand Down Expand Up @@ -264,7 +290,9 @@ def set_package():
file = request.files["file"]
except KeyError:
return jsonify({"success": False, "message": "Missing file."}), 400
return api.set_compute_package(file=file, helper_type=helper_type, name=name, description=description)
return api.set_compute_package(
file=file, helper_type=helper_type, name=name, description=description
)


@app.route("/get_package", methods=["GET"])
Expand All @@ -288,9 +316,7 @@ def list_compute_packages():
include_active = request.args.get("include_active", None)

return api.list_compute_packages(
limit=limit,
skip=skip,
include_active=include_active
limit=limit, skip=skip, include_active=include_active
)


Expand Down Expand Up @@ -322,21 +348,22 @@ def get_latest_model():
@app.route("/set_current_model", methods=["PUT"])
def set_current_model():
"""Set the initial model in the statestore and upload to model repository.
Usage with curl:
curl -k -X PUT
-F id=<model-id>
http://localhost:8092/set_current_model

param: id: The model id to set.
type: id: str
return: boolean.
rtype: json
"""
Usage with curl:
curl -k -X PUT
-F id=<model-id>
http://localhost:8092/set_current_model

param: id: The model id to set.
type: id: str
return: boolean.
rtype: json
"""
id = request.args.get("id", None)
if id is None:
return jsonify({"success": False, "message": "Missing model id."}), 400
return api.set_current_model(id)


# Get initial model endpoint


Expand Down
Empty file.
Loading
Loading