Skip to content

Commit f18886c

Browse files
expose list_solver_ports to api server (#4824)
1 parent e98c5bb commit f18886c

File tree

6 files changed

+142
-8
lines changed

6 files changed

+142
-8
lines changed

services/api-server/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.5
1+
0.5.0

services/api-server/openapi.json

Lines changed: 132 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"info": {
44
"title": "osparc.io web API",
55
"description": "osparc-simcore public API specifications",
6-
"version": "0.4.5"
6+
"version": "0.5.0"
77
},
88
"paths": {
99
"/v0/meta": {
@@ -535,6 +535,65 @@
535535
]
536536
}
537537
},
538+
"/v0/solvers/{solver_key}/releases/{version}/ports": {
539+
"get": {
540+
"tags": [
541+
"solvers"
542+
],
543+
"summary": "List Solver Ports",
544+
"description": "Lists inputs and outputs of a given solver\n\nNew in *version 0.5.0*",
545+
"operationId": "list_solver_ports",
546+
"parameters": [
547+
{
548+
"required": true,
549+
"schema": {
550+
"title": "Solver Key",
551+
"pattern": "^simcore/services/comp/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
552+
"type": "string"
553+
},
554+
"name": "solver_key",
555+
"in": "path"
556+
},
557+
{
558+
"required": true,
559+
"schema": {
560+
"title": "Version",
561+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
562+
"type": "string"
563+
},
564+
"name": "version",
565+
"in": "path"
566+
}
567+
],
568+
"responses": {
569+
"200": {
570+
"description": "Successful Response",
571+
"content": {
572+
"application/json": {
573+
"schema": {
574+
"$ref": "#/components/schemas/OnePage_SolverPort_"
575+
}
576+
}
577+
}
578+
},
579+
"422": {
580+
"description": "Validation Error",
581+
"content": {
582+
"application/json": {
583+
"schema": {
584+
"$ref": "#/components/schemas/HTTPValidationError"
585+
}
586+
}
587+
}
588+
}
589+
},
590+
"security": [
591+
{
592+
"HTTPBasic": []
593+
}
594+
]
595+
}
596+
},
538597
"/v0/solvers/{solver_key}/releases/{version}/jobs": {
539598
"get": {
540599
"tags": [
@@ -1161,8 +1220,14 @@
11611220
},
11621221
"checksum": {
11631222
"title": "Checksum",
1223+
"pattern": "^[a-fA-F0-9]{64}$",
1224+
"type": "string",
1225+
"description": "SHA256 hash of the file's content"
1226+
},
1227+
"e_tag": {
1228+
"title": "E Tag",
11641229
"type": "string",
1165-
"description": "MD5 hash of the file's content [EXPERIMENTAL]"
1230+
"description": "S3 entity tag"
11661231
}
11671232
},
11681233
"description": "Represents a file stored on the server side i.e. a unique reference to a file in the cloud."
@@ -1490,6 +1555,28 @@
14901555
"docs_dev_url": "https://api.osparc.io/dev/doc"
14911556
}
14921557
},
1558+
"OnePage_SolverPort_": {
1559+
"title": "OnePage[SolverPort]",
1560+
"required": [
1561+
"items"
1562+
],
1563+
"type": "object",
1564+
"properties": {
1565+
"items": {
1566+
"title": "Items",
1567+
"type": "array",
1568+
"items": {
1569+
"$ref": "#/components/schemas/SolverPort"
1570+
}
1571+
},
1572+
"total": {
1573+
"title": "Total",
1574+
"minimum": 0,
1575+
"type": "integer"
1576+
}
1577+
},
1578+
"description": "A single page is used to envelope a small sequence that does not require\npagination\n\nIf total > MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE, we should consider extending this\nentrypoint to proper pagination"
1579+
},
14931580
"Profile": {
14941581
"title": "Profile",
14951582
"required": [
@@ -1574,7 +1661,8 @@
15741661
"STARTED",
15751662
"SUCCESS",
15761663
"FAILED",
1577-
"ABORTED"
1664+
"ABORTED",
1665+
"WAITING_FOR_CLUSTER"
15781666
],
15791667
"type": "string",
15801668
"description": "State of execution of a project's computational workflow\n\nSEE StateType for task state"
@@ -1634,13 +1722,54 @@
16341722
"url": "https://api.osparc.io/v0/solvers/simcore%2Fservices%2Fcomp%2Fisolve/releases/2.1.1"
16351723
}
16361724
},
1725+
"SolverPort": {
1726+
"title": "SolverPort",
1727+
"required": [
1728+
"key",
1729+
"kind"
1730+
],
1731+
"type": "object",
1732+
"properties": {
1733+
"key": {
1734+
"title": "Key name",
1735+
"pattern": "^[^_\\W0-9]\\w*$",
1736+
"type": "string",
1737+
"description": "port identifier name"
1738+
},
1739+
"kind": {
1740+
"title": "Kind",
1741+
"enum": [
1742+
"input",
1743+
"output"
1744+
],
1745+
"type": "string"
1746+
},
1747+
"content_schema": {
1748+
"title": "Content Schema",
1749+
"type": "object",
1750+
"description": "jsonschema for the port's value. SEE https://json-schema.org"
1751+
}
1752+
},
1753+
"example": {
1754+
"key": "input_2",
1755+
"kind": "input",
1756+
"content_schema": {
1757+
"title": "Sleep interval",
1758+
"type": "integer",
1759+
"x_unit": "second",
1760+
"minimum": 0,
1761+
"maximum": 5
1762+
}
1763+
}
1764+
},
16371765
"UserRoleEnum": {
16381766
"title": "UserRoleEnum",
16391767
"enum": [
16401768
"ANONYMOUS",
16411769
"GUEST",
16421770
"USER",
16431771
"TESTER",
1772+
"PRODUCT_OWNER",
16441773
"ADMIN"
16451774
],
16461775
"type": "string",

services/api-server/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.4.5
2+
current_version = 0.5.0
33
commit = True
44
message = services/api-server version: {current_version} → {new_version}
55
tag = False

services/api-server/src/simcore_service_api_server/api/routes/files.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ async def get_file(
300300
":search",
301301
response_model=Page[File],
302302
responses={**_COMMON_ERROR_RESPONSES},
303+
include_in_schema=API_SERVER_DEV_FEATURES_ENABLED,
303304
)
304305
async def search_files_page(
305306
storage_client: Annotated[StorageApi, Depends(get_api_client(StorageApi))],

services/api-server/src/simcore_service_api_server/api/routes/solvers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ async def get_solver_release(
215215
@router.get(
216216
"/{solver_key:path}/releases/{version}/ports",
217217
response_model=OnePage[SolverPort],
218-
include_in_schema=API_SERVER_DEV_FEATURES_ENABLED,
219218
)
220219
async def list_solver_ports(
221220
solver_key: SolverKeyId,
@@ -226,7 +225,7 @@ async def list_solver_ports(
226225
):
227226
"""Lists inputs and outputs of a given solver
228227
229-
New in *version 0.5.0* (only with API_SERVER_DEV_FEATURES_ENABLED=1)
228+
New in *version 0.5.0*
230229
"""
231230
try:
232231
ports = await catalog_client.get_service_ports(

services/api-server/tests/unit/test_api_health.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# pylint: disable=unused-variable
66

77

8+
from pathlib import Path
9+
810
from fastapi import status
911
from httpx import AsyncClient
1012
from models_library.app_diagnostics import AppStatusCheck
@@ -29,9 +31,12 @@ async def test_get_service_state(
2931
response = await client.get(f"{API_VTAG}/state")
3032
assert response.status_code == status.HTTP_200_OK
3133

34+
version_file: Path = Path(__file__).parent.parent.parent / "VERSION"
35+
assert version_file.is_file()
36+
3237
assert response.json() == {
3338
"app_name": "simcore-service-api-server",
34-
"version": "0.4.5",
39+
"version": version_file.read_text().strip(),
3540
"services": {
3641
"catalog": {"healthy": True},
3742
"director_v2": {"healthy": True},

0 commit comments

Comments
 (0)