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

♻️ web-api: Updated catalog interface and drafted performance test for pagination #6189

Merged
merged 18 commits into from
Aug 20, 2024
Merged
17 changes: 10 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,21 @@ pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.cache
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
cov.xml
*.cover
.hypothesis/
.pytest_cache/
.tox/
*.cover
cov.xml
coverage.xml
htmlcov/
locust_report/
nosetests.xml
test_failures/


# Translations
*.mo
*.pot
Expand Down
36 changes: 4 additions & 32 deletions api/specs/web-server/_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from models_library.api_schemas_webserver.catalog import (
CatalogServiceGet,
CatalogServiceUpdate,
ServiceGet,
ServiceInputGet,
ServiceInputKey,
ServiceOutputGet,
Expand Down Expand Up @@ -38,51 +37,24 @@


@router.get(
"/dev/catalog/services/-/latest",
"/catalog/services/-/latest",
response_model=Page[CatalogServiceGet],
)
def dev_list_services_latest(_query_params: Annotated[ListServiceParams, Depends()]):
pass


@router.get(
"/dev/catalog/services/{service_key}/{service_version}",
response_model=Envelope[CatalogServiceGet],
)
def dev_get_service(_path_params: Annotated[ServicePathParams, Depends()]):
...


@router.patch(
"/dev/catalog/services/{service_key}/{service_version}",
response_model=Envelope[CatalogServiceGet],
)
def dev_update_service(
_path_params: Annotated[ServicePathParams, Depends()],
_update: CatalogServiceUpdate,
):
...


@router.get(
"/catalog/services",
response_model=Envelope[list[ServiceGet]],
)
def list_services():
def list_services_latest(_query_params: Annotated[ListServiceParams, Depends()]):
pass


@router.get(
"/catalog/services/{service_key}/{service_version}",
response_model=Envelope[ServiceGet],
response_model=Envelope[CatalogServiceGet],
)
def get_service(_path_params: Annotated[ServicePathParams, Depends()]):
...


@router.patch(
"/catalog/services/{service_key}/{service_version}",
response_model=Envelope[ServiceGet],
response_model=Envelope[CatalogServiceGet],
)
def update_service(
_path_params: Annotated[ServicePathParams, Depends()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,27 +467,27 @@ qx.Class.define("osparc.data.Resources", {
},

/*
* SERVICES DEV
* SERVICES V2 (web-api >=0.42.0)
*/
"servicesDev": {
"servicesV2": {
useCache: false, // handled in osparc.service.Store
idField: ["key", "version"],
endpoints: {
get: {
method: "GET",
url: statics.API + "/dev/catalog/services/-/latest"
url: statics.API + "/catalog/services/-/latest"
},
getPage: {
method: "GET",
url: statics.API + "/dev/catalog/services/-/latest?offset={offset}&limit={limit}"
url: statics.API + "/catalog/services/-/latest?offset={offset}&limit={limit}"
},
getOne: {
method: "GET",
url: statics.API + "/dev/catalog/services/{key}/{version}"
url: statics.API + "/catalog/services/{key}/{version}"
},
patch: {
method: "PATCH",
url: statics.API + "/dev/catalog/services/{key}/{version}"
url: statics.API + "/catalog/services/{key}/{version}"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ qx.Class.define("osparc.service.Store", {
return;
}

osparc.data.Resources.getInstance().getAllPages("servicesDev")
osparc.data.Resources.getInstance().getAllPages("servicesV2")
.then(servicesArray => {
const servicesObj = osparc.service.Utils.convertArrayToObject(servicesArray);
this.__addHits(servicesObj);
Expand Down Expand Up @@ -58,7 +58,7 @@ qx.Class.define("osparc.service.Store", {
const params = {
url: osparc.data.Resources.getServiceUrl(key, version)
};
osparc.data.Resources.getOne("servicesDev", params)
osparc.data.Resources.getOne("servicesV2", params)
.then(service => {
this.__addHit(service);
this.__addTSRInfo(service);
Expand Down Expand Up @@ -106,7 +106,7 @@ qx.Class.define("osparc.service.Store", {
url: osparc.data.Resources.getServiceUrl(key, version),
data: patchData
};
return osparc.data.Resources.fetch("servicesDev", "patch", params)
return osparc.data.Resources.fetch("servicesV2", "patch", params)
.then(() => {
this.servicesCached[key][version][fieldKey] = value;
serviceData[fieldKey] = value;
Expand Down
2 changes: 1 addition & 1 deletion services/web/server/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.41.0
0.42.0
2 changes: 1 addition & 1 deletion services/web/server/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.41.0
current_version = 0.42.0
commit = True
message = services/webserver api version: {current_version} → {new_version}
tag = False
Expand Down
Loading
Loading