|
85 | 85 | from servicelib.rabbitmq.rpc_interfaces.webserver.licenses.licensed_items import ( |
86 | 86 | release_licensed_item_for_wallet as _release_licensed_item_for_wallet, |
87 | 87 | ) |
| 88 | +from servicelib.rabbitmq.rpc_interfaces.webserver.v1 import WebServerRpcClient |
88 | 89 | from simcore_service_api_server.models.basic_types import NameValueTuple |
89 | 90 |
|
| 91 | +from ..core.settings import WebServerSettings |
90 | 92 | from ..exceptions.backend_errors import ( |
91 | 93 | CanNotCheckoutServiceIsNotRunningError, |
| 94 | + ConfigurationError, |
92 | 95 | InsufficientNumberOfSeatsError, |
93 | 96 | JobForbiddenAccessError, |
94 | 97 | JobNotFoundError, |
@@ -138,6 +141,7 @@ def _create_licensed_items_get_page( |
138 | 141 | class WbApiRpcClient(SingletonInAppStateMixin): |
139 | 142 | app_state_name = "wb_api_rpc_client" |
140 | 143 | _client: RabbitMQRPCClient |
| 144 | + _rpc_client: WebServerRpcClient |
141 | 145 |
|
142 | 146 | @_exception_mapper(rpc_exception_map={}) |
143 | 147 | async def get_licensed_items( |
@@ -253,8 +257,7 @@ async def mark_project_as_job( |
253 | 257 | job_parent_resource_name: RelativeResourceName, |
254 | 258 | storage_assets_deleted: bool, # noqa: FBT001 |
255 | 259 | ): |
256 | | - await projects_rpc.mark_project_as_job( |
257 | | - rpc_client=self._client, |
| 260 | + await self._rpc_client.projects.mark_project_as_job( |
258 | 261 | product_name=product_name, |
259 | 262 | user_id=user_id, |
260 | 263 | project_uuid=project_uuid, |
@@ -702,5 +705,14 @@ async def get_functions_user_api_access_rights( |
702 | 705 |
|
703 | 706 |
|
704 | 707 | 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 | + ) |
706 | 718 | wb_api_rpc_client.set_to_app_state(app=app) |
0 commit comments