Skip to content

Commit a7d2620

Browse files
committed
connecting new rpc client
1 parent a43c4dd commit a7d2620

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

services/api-server/src/simcore_service_api_server/services_rpc/wb_api_server.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@
8585
from servicelib.rabbitmq.rpc_interfaces.webserver.licenses.licensed_items import (
8686
release_licensed_item_for_wallet as _release_licensed_item_for_wallet,
8787
)
88+
from servicelib.rabbitmq.rpc_interfaces.webserver.v1 import WebServerRpcClient
8889
from simcore_service_api_server.models.basic_types import NameValueTuple
8990

91+
from ..core.settings import WebServerSettings
9092
from ..exceptions.backend_errors import (
9193
CanNotCheckoutServiceIsNotRunningError,
94+
ConfigurationError,
9295
InsufficientNumberOfSeatsError,
9396
JobForbiddenAccessError,
9497
JobNotFoundError,
@@ -138,6 +141,7 @@ def _create_licensed_items_get_page(
138141
class WbApiRpcClient(SingletonInAppStateMixin):
139142
app_state_name = "wb_api_rpc_client"
140143
_client: RabbitMQRPCClient
144+
_rpc_client: WebServerRpcClient
141145

142146
@_exception_mapper(rpc_exception_map={})
143147
async def get_licensed_items(
@@ -253,8 +257,7 @@ async def mark_project_as_job(
253257
job_parent_resource_name: RelativeResourceName,
254258
storage_assets_deleted: bool, # noqa: FBT001
255259
):
256-
await projects_rpc.mark_project_as_job(
257-
rpc_client=self._client,
260+
await self._rpc_client.projects.mark_project_as_job(
258261
product_name=product_name,
259262
user_id=user_id,
260263
project_uuid=project_uuid,
@@ -702,5 +705,14 @@ async def get_functions_user_api_access_rights(
702705

703706

704707
def setup(app: FastAPI, rabbitmq_rmp_client: RabbitMQRPCClient):
705-
wb_api_rpc_client = WbApiRpcClient(_client=rabbitmq_rmp_client)
708+
webserver_settings: WebServerSettings = app.state.settings.API_SERVER_WEBSERVER
709+
if not webserver_settings:
710+
raise ConfigurationError(tip="Webserver settings are not configured")
711+
712+
wb_api_rpc_client = WbApiRpcClient(
713+
_client=rabbitmq_rmp_client,
714+
_rpc_client=WebServerRpcClient(
715+
rabbitmq_rmp_client, webserver_settings.WEBSERVER_RPC_NAMESPACE
716+
),
717+
)
706718
wb_api_rpc_client.set_to_app_state(app=app)

0 commit comments

Comments
 (0)