Skip to content

Commit fc9245f

Browse files
committed
add Deprecated note @pcrespov
1 parent 086f9ea commit fc9245f

File tree

7 files changed

+63
-13
lines changed

7 files changed

+63
-13
lines changed

services/api-server/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@
23562356
"solvers"
23572357
],
23582358
"summary": "List Jobs",
2359-
"description": "List of jobs in a specific released solver (limited to 20 jobs)\n\n- DEPRECATION: This implementation and returned values are deprecated and the will be replaced by that of get_jobs_page\n- SEE `get_jobs_page` for paginated version of this function",
2359+
"description": "\ud83d\udea8 **Deprecated**: This endpoint is deprecated and will be removed in a future release.\nPlease use `GET /{solver_key}/releases/{version}/jobs/page` instead.\n\n\n\nList of jobs in a specific released solver\n\nNew in *version 0.5*\n\nRemoved in *version 0.7*: This endpoint is deprecated and will be removed in a future version",
23602360
"operationId": "list_jobs",
23612361
"security": [
23622362
{

services/api-server/src/simcore_service_api_server/_service_programs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
class ProgramService:
1212
_catalog_service: CatalogService
1313

14-
def __init__(
15-
self, _catalog_service: Annotated[CatalogService, Depends(CatalogService)]
16-
):
14+
def __init__(self, _catalog_service: Annotated[CatalogService, Depends()]):
1715
self._catalog_service = _catalog_service
1816

1917
async def get_program(

services/api-server/src/simcore_service_api_server/_service_solvers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
class SolverService:
2020
_catalog_service: CatalogService
2121

22-
def __init__(
23-
self, catalog_service: Annotated[CatalogService, Depends(CatalogService)]
24-
):
22+
def __init__(self, catalog_service: Annotated[CatalogService, Depends()]):
2523
self._catalog_service = catalog_service
2624

2725
async def get_solver(

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,41 @@
2020

2121
# removed on inputs/outputs in routes
2222
FMSG_CHANGELOG_REMOVED_IN_VERSION_FORMAT: Final[str] = "Removed in *version {}*: {}\n"
23+
24+
FMSG_DEPRECATED_ROUTE_NOTICE: Final[str] = (
25+
"🚨 **Deprecated**: This endpoint is deprecated and will be removed in a future release.\n"
26+
"Please use `{}` instead.\n\n"
27+
)
28+
29+
30+
def create_route_description(
31+
*,
32+
base: str = "",
33+
deprecated: bool = False,
34+
alternative: str | None = None, # alternative
35+
changelog: list[str] | None = None
36+
) -> str:
37+
"""
38+
Builds a consistent route description with optional deprecation and changelog information.
39+
40+
Args:
41+
base (str): Main route description.
42+
deprecated (tuple): (retirement_date, alternative_route) if deprecated.
43+
changelog (List[str]): List of formatted changelog strings.
44+
45+
Returns:
46+
str: Final description string.
47+
"""
48+
parts = []
49+
50+
if deprecated:
51+
assert alternative, "If deprecated, alternative must be provided" # nosec
52+
parts.append(FMSG_DEPRECATED_ROUTE_NOTICE.format(alternative))
53+
54+
if base:
55+
parts.append(base)
56+
57+
if changelog:
58+
parts.append("\n".join(changelog))
59+
60+
return "\n\n".join(parts)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def get_program_release(
6868
program_key: ProgramKeyId,
6969
version: VersionStr,
7070
user_id: Annotated[int, Depends(get_current_user_id)],
71-
program_service: Annotated[ProgramService, Depends(ProgramService)],
71+
program_service: Annotated[ProgramService, Depends()],
7272
url_for: Annotated[Callable, Depends(get_reverse_url_mapper)],
7373
product_name: Annotated[str, Depends(get_product_name)],
7474
) -> Program:
@@ -107,8 +107,8 @@ async def create_program_job(
107107
program_key: ProgramKeyId,
108108
version: VersionStr,
109109
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
110-
program_service: Annotated[ProgramService, Depends(ProgramService)],
111-
job_service: Annotated[JobService, Depends(JobService)],
110+
program_service: Annotated[ProgramService, Depends()],
111+
job_service: Annotated[JobService, Depends()],
112112
url_for: Annotated[Callable, Depends(get_reverse_url_mapper)],
113113
product_name: Annotated[str, Depends(get_product_name)],
114114
x_simcore_parent_project_uuid: Annotated[ProjectID | None, Header()] = None,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ async def create_solver_job(
9595
version: VersionStr,
9696
inputs: JobInputs,
9797
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
98-
solver_service: Annotated[SolverService, Depends(SolverService)],
99-
job_service: Annotated[JobService, Depends(JobService)],
98+
solver_service: Annotated[SolverService, Depends()],
99+
job_service: Annotated[JobService, Depends()],
100100
wb_api_rpc: Annotated[WbApiRpcClient, Depends(get_wb_api_rpc_client)],
101101
url_for: Annotated[Callable, Depends(get_reverse_url_mapper)],
102102
product_name: Annotated[str, Depends(get_product_name)],

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@
5555
from ..dependencies.rabbitmq import get_log_check_timeout, get_log_distributor
5656
from ..dependencies.services import get_api_client
5757
from ..dependencies.webserver_http import AuthSession, get_webserver_session
58-
from ._constants import FMSG_CHANGELOG_NEW_IN_VERSION
58+
from ._constants import (
59+
FMSG_CHANGELOG_NEW_IN_VERSION,
60+
FMSG_CHANGELOG_REMOVED_IN_VERSION_FORMAT,
61+
create_route_description,
62+
)
5963
from .solvers_jobs import (
6064
JOBS_STATUS_CODES,
6165
METADATA_STATUS_CODES,
@@ -118,6 +122,18 @@
118122
"/{solver_key:path}/releases/{version}/jobs",
119123
response_model=list[Job],
120124
responses=JOBS_STATUS_CODES,
125+
description=create_route_description(
126+
base="List of jobs in a specific released solver",
127+
deprecated=True,
128+
alternative="GET /{solver_key}/releases/{version}/jobs/page",
129+
changelog=[
130+
FMSG_CHANGELOG_NEW_IN_VERSION.format("0.5"),
131+
FMSG_CHANGELOG_REMOVED_IN_VERSION_FORMAT.format(
132+
"0.7",
133+
"This endpoint is deprecated and will be removed in a future version",
134+
),
135+
],
136+
),
121137
)
122138
async def list_jobs(
123139
solver_key: SolverKeyId,

0 commit comments

Comments
 (0)