Skip to content

Commit ae8ce24

Browse files
committed
rename back
1 parent 5b7abe3 commit ae8ce24

File tree

9 files changed

+55
-35
lines changed

9 files changed

+55
-35
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
DEFAULT_PAGINATION_LIMIT = 999 # MAXIMUM_NUMBER_OF_ITEMS_PER_PAGE - 1
2828

2929

30-
class JobsService:
30+
class JobService:
3131
# clients
3232
_web_rest_api: AuthSession
3333
_web_rpc_api: WbApiRpcClient

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_jobs import JobsService
20+
from ._service_jobs import JobService
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-
_jobs_service: JobsService
31+
_job_service: JobService
3232

3333
def __init__(
3434
self,
3535
catalog_service: CatalogService,
36-
jobs_service: JobsService,
36+
job_service: JobService,
3737
):
3838
self._catalog_service = catalog_service
39-
self._jobs_service = jobs_service
39+
self._job_service = job_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._jobs_service.list_jobs_by_resource_prefix(
119+
return await self._job_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_jobs import JobsService
9+
from ._service_jobs import JobService
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-
_jobs_service: JobsService
17+
_job_service: JobService
1818

1919
def __init__(
2020
self,
21-
jobs_service: JobsService,
21+
job_service: JobService,
2222
):
23-
self._jobs_service = jobs_service
23+
self._job_service = job_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._jobs_service.list_jobs_by_resource_prefix(
48+
return await self._job_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_jobs import JobsService
12+
from ..._service_jobs import JobService
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_jobs_service(
58+
def get_job_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-
) -> JobsService:
63+
) -> JobService:
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 JobsService(
68+
return JobService(
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_jobs_service(
7575

7676
def get_solver_service(
7777
catalog_service: Annotated[CatalogService, Depends(get_catalog_service)],
78-
jobs_service: Annotated[JobsService, Depends(get_jobs_service)],
78+
job_service: Annotated[JobService, Depends(get_job_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-
jobs_service=jobs_service,
87+
job_service=job_service,
8888
)
8989

9090

9191
def get_studies_service(
92-
jobs_service: Annotated[JobsService, Depends(get_jobs_service)],
92+
job_service: Annotated[JobService, Depends(get_job_service)],
9393
) -> StudiesService:
9494
return StudiesService(
95-
jobs_service=jobs_service,
95+
job_service=job_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_jobs import JobsService
22+
from ..._service_jobs import JobService
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-
jobs_service: Annotated[JobsService, Depends()],
167+
job_service: Annotated[JobService, 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 jobs_service.create_job(
190+
job, project = await job_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_jobs import JobsService
15+
from ..._service_jobs import JobService
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-
jobs_service: Annotated[JobsService, Depends()],
95+
job_service: Annotated[JobService, 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 jobs_service.create_job(
114+
job, _ = await job_service.create_job(
115115
project_name=None,
116116
description=None,
117117
solver_or_program=solver,

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

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,44 @@
77
from models_library.products import ProductName
88
from models_library.users import UserID
99
from pytest_mock import MockerFixture, MockType
10+
from simcore_service_api_server._service_jobs import JobService
1011
from simcore_service_api_server._service_solvers import SolverService
1112
from simcore_service_api_server.models.schemas.solvers import Solver
1213
from simcore_service_api_server.services_rpc.catalog import CatalogService
1314
from simcore_service_api_server.services_rpc.wb_api_server import WbApiRpcClient
1415

1516

1617
@pytest.fixture
17-
def solver_service(
18+
def job_service(
1819
mocker: MockerFixture,
19-
mocked_catalog_rpc_api: dict[str, MockType],
2020
mocked_webserver_rpc_api: dict[str, MockType],
21-
) -> SolverService:
22-
return SolverService(
23-
catalog_service=CatalogService(client=mocker.MagicMock()),
24-
webserver_client=WbApiRpcClient(_client=mocker.MagicMock()),
21+
product_name: ProductName,
22+
user_id: UserID,
23+
) -> JobService:
24+
return JobService(
25+
web_rest_api=mocker.MagicMock(),
26+
web_rpc_api=WbApiRpcClient(_client=mocker.MagicMock()),
27+
user_id=user_id,
28+
product_name=product_name,
2529
)
2630

2731

32+
@pytest.fixture
33+
def catalog_service(
34+
mocker: MockerFixture,
35+
mocked_catalog_rpc_api: dict[str, MockType],
36+
) -> CatalogService:
37+
return CatalogService(client=mocker.MagicMock())
38+
39+
40+
@pytest.fixture
41+
def solver_service(
42+
catalog_service: CatalogService,
43+
job_service: JobService,
44+
) -> SolverService:
45+
return SolverService(catalog_service=catalog_service, job_service=job_service)
46+
47+
2848
async def test_get_solver(
2949
solver_service: SolverService,
3050
mocked_catalog_rpc_api: dict[str, MockType],

services/web/server/src/simcore_service_webserver/projects/_controller/projects_rpc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
)
1717

1818
from ...rabbitmq import get_rabbitmq_rpc_server
19-
from .. import _jobs_service
19+
from .. import _job_service
2020
from ..exceptions import ProjectInvalidRightsError, ProjectNotFoundError
2121

2222
router = RPCRouter()
@@ -41,7 +41,7 @@ async def mark_project_as_job(
4141

4242
try:
4343

44-
await _jobs_service.set_project_as_job(
44+
await _job_service.set_project_as_job(
4545
app,
4646
product_name=product_name,
4747
user_id=user_id,
@@ -69,7 +69,7 @@ async def list_projects_marked_as_jobs(
6969
job_parent_resource_name_prefix: str | None,
7070
) -> PageRpcProjectJobRpcGet:
7171

72-
total, projects = await _jobs_service.list_my_projects_marked_as_jobs(
72+
total, projects = await _job_service.list_my_projects_marked_as_jobs(
7373
app,
7474
product_name=product_name,
7575
user_id=user_id,

services/web/server/tests/unit/with_dbs/02/test_projects__jobs_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from models_library.projects import ProjectID
1313
from models_library.users import UserID
1414
from pytest_simcore.helpers.webserver_login import UserInfoDict
15-
from simcore_service_webserver.projects._jobs_service import (
15+
from simcore_service_webserver.projects._job_service import (
1616
list_my_projects_marked_as_jobs,
1717
set_project_as_job,
1818
)

0 commit comments

Comments
 (0)