Skip to content

Commit 5b7abe3

Browse files
committed
jobs_service
1 parent dc4ebe8 commit 5b7abe3

File tree

7 files changed

+27
-25
lines changed

7 files changed

+27
-25
lines changed

services/api-server/src/simcore_service_api_server/_service_job.py renamed to services/api-server/src/simcore_service_api_server/_service_jobs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@
2727
DEFAULT_PAGINATION_LIMIT = 999 # MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE - 1
2828

2929

30-
class JobService:
30+
class JobsService:
31+
# clients
3132
_web_rest_api: AuthSession
3233
_web_rpc_api: WbApiRpcClient
34+
# context
3335
_user_id: UserID
3436
_product_name: ProductName
3537

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
SolverServiceListJobsFiltersError,
1818
)
1919

20-
from ._service_job import JobService
20+
from ._service_jobs import JobsService
2121
from .models.api_resources import compose_resource_name
2222
from .models.schemas.jobs import Job
2323
from .models.schemas.solvers import Solver, SolverKeyId
@@ -28,15 +28,15 @@
2828

2929
class SolverService:
3030
_catalog_service: CatalogService
31-
_job_service: JobService
31+
_jobs_service: JobsService
3232

3333
def __init__(
3434
self,
3535
catalog_service: CatalogService,
36-
job_service: JobService,
36+
jobs_service: JobsService,
3737
):
3838
self._catalog_service = catalog_service
39-
self._job_service = job_service
39+
self._jobs_service = jobs_service
4040

4141
async def get_solver(
4242
self,
@@ -116,7 +116,7 @@ async def list_jobs(
116116
)
117117

118118
# Use the common implementation from JobService
119-
return await self._job_service.list_jobs_by_resource_prefix(
119+
return await self._jobs_service.list_jobs_by_resource_prefix(
120120
offset=offset,
121121
limit=limit,
122122
job_parent_resource_name_prefix=job_parent_resource_name_prefix,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
from models_library.rpc_pagination import PageLimitInt
77
from simcore_service_api_server.models.schemas.studies import StudyID
88

9-
from ._service_job import JobService
9+
from ._service_jobs import JobsService
1010
from .models.api_resources import compose_resource_name
1111
from .models.schemas.jobs import Job
1212

1313
DEFAULT_PAGINATION_LIMIT = MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE - 1
1414

1515

1616
class StudiesService:
17-
_job_service: JobService
17+
_jobs_service: JobsService
1818

1919
def __init__(
2020
self,
21-
job_service: JobService,
21+
jobs_service: JobsService,
2222
):
23-
self._job_service = job_service
23+
self._jobs_service = jobs_service
2424

2525
async def list_jobs(
2626
self,
@@ -45,7 +45,7 @@ async def list_jobs(
4545
)
4646

4747
# Use the common implementation from JobService
48-
return await self._job_service.list_jobs_by_resource_prefix(
48+
return await self._jobs_service.list_jobs_by_resource_prefix(
4949
offset=offset,
5050
limit=limit,
5151
job_parent_resource_name_prefix=job_parent_resource_name_prefix,

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from servicelib.rabbitmq import RabbitMQRPCClient
1010
from simcore_service_api_server._service_studies import StudiesService
1111

12-
from ..._service_job import JobService
12+
from ..._service_jobs import JobsService
1313
from ..._service_solvers import SolverService
1414
from ...services_rpc.catalog import CatalogService
1515
from ...services_rpc.wb_api_server import WbApiRpcClient
@@ -55,17 +55,17 @@ def get_catalog_service(
5555
return CatalogService(client=rpc_client)
5656

5757

58-
def get_job_service(
58+
def get_jobs_service(
5959
web_rest_api: Annotated[AuthSession, Depends(get_webserver_session)],
6060
web_rpc_api: Annotated[WbApiRpcClient, Depends(get_wb_api_rpc_client)],
6161
user_id: Annotated[UserID, Depends(get_current_user_id)],
6262
product_name: Annotated[ProductName, Depends(get_product_name)],
63-
) -> JobService:
63+
) -> JobsService:
6464
"""
6565
"Assembles" the JobsService layer to the underlying service and client interfaces
6666
in the context of the rest controller (i.e. api/dependencies)
6767
"""
68-
return JobService(
68+
return JobsService(
6969
web_rest_api=web_rest_api,
7070
web_rpc_api=web_rpc_api,
7171
user_id=user_id,
@@ -75,7 +75,7 @@ def get_job_service(
7575

7676
def get_solver_service(
7777
catalog_service: Annotated[CatalogService, Depends(get_catalog_service)],
78-
job_service: Annotated[JobService, Depends(get_job_service)],
78+
jobs_service: Annotated[JobsService, Depends(get_jobs_service)],
7979
) -> SolverService:
8080
"""
8181
"Assembles" the SolverService layer to the underlying service and client interfaces
@@ -84,13 +84,13 @@ def get_solver_service(
8484

8585
return SolverService(
8686
catalog_service=catalog_service,
87-
job_service=job_service,
87+
jobs_service=jobs_service,
8888
)
8989

9090

9191
def get_studies_service(
92-
job_service: Annotated[JobService, Depends(get_job_service)],
92+
jobs_service: Annotated[JobsService, Depends(get_jobs_service)],
9393
) -> StudiesService:
9494
return StudiesService(
95-
job_service=job_service,
95+
jobs_service=jobs_service,
9696
)

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
@@ -19,7 +19,7 @@
1919
get_upload_links_from_s3,
2020
)
2121

22-
from ..._service_job import JobService
22+
from ..._service_jobs import JobsService
2323
from ..._service_programs import ProgramService
2424
from ...api.routes._constants import (
2525
DEFAULT_MAX_STRING_LENGTH,
@@ -164,7 +164,7 @@ async def create_program_job(
164164
version: VersionStr,
165165
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
166166
program_service: Annotated[ProgramService, Depends()],
167-
job_service: Annotated[JobService, Depends()],
167+
jobs_service: Annotated[JobsService, Depends()],
168168
url_for: Annotated[Callable, Depends(get_reverse_url_mapper)],
169169
product_name: Annotated[str, Depends(get_product_name)],
170170
x_simcore_parent_project_uuid: Annotated[ProjectID | None, Header()] = None,
@@ -187,7 +187,7 @@ async def create_program_job(
187187
product_name=product_name,
188188
)
189189

190-
job, project = await job_service.create_job(
190+
job, project = await jobs_service.create_job(
191191
project_name=name,
192192
description=description,
193193
solver_or_program=program,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from models_library.projects_nodes_io import NodeID
1313
from pydantic.types import PositiveInt
1414

15-
from ..._service_job import JobService
15+
from ..._service_jobs import JobsService
1616
from ..._service_solvers import SolverService
1717
from ...exceptions.backend_errors import ProjectAlreadyStartedError
1818
from ...exceptions.service_errors_utils import DEFAULT_BACKEND_SERVICE_STATUS_CODES
@@ -92,7 +92,7 @@ async def create_solver_job(
9292
inputs: JobInputs,
9393
user_id: Annotated[PositiveInt, Depends(get_current_user_id)],
9494
solver_service: Annotated[SolverService, Depends(get_solver_service)],
95-
job_service: Annotated[JobService, Depends()],
95+
jobs_service: Annotated[JobsService, Depends()],
9696
url_for: Annotated[Callable, Depends(get_reverse_url_mapper)],
9797
product_name: Annotated[str, Depends(get_product_name)],
9898
hidden: Annotated[bool, Query()] = True,
@@ -111,7 +111,7 @@ async def create_solver_job(
111111
solver_version=version,
112112
product_name=product_name,
113113
)
114-
job, _ = await job_service.create_job(
114+
job, _ = await jobs_service.create_job(
115115
project_name=None,
116116
description=None,
117117
solver_or_program=solver,

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

Whitespace-only changes.

0 commit comments

Comments
 (0)