Skip to content

Commit 5b348fd

Browse files
continue
1 parent f909d18 commit 5b348fd

File tree

3 files changed

+15
-12
lines changed
  • packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/webserver
  • services
    • director-v2/src/simcore_service_director_v2/modules/osparc_variables
    • web/server/src/simcore_service_webserver/products

3 files changed

+15
-12
lines changed

packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/webserver/products.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ async def get_product_base_url(
1616
rpc_client: RabbitMQRPCClient,
1717
*,
1818
product_name: ProductName,
19-
) -> None:
19+
) -> str:
2020

2121
base_url = await rpc_client.request(
2222
WEBSERVER_RPC_NAMESPACE,
2323
TypeAdapter(RPCMethodName).validate_python("get_product_base_url"),
2424
product_name=product_name,
2525
)
2626
assert base_url # nosec
27+
assert isinstance(base_url, str) # nosec
2728
return base_url

services/director-v2/src/simcore_service_director_v2/modules/osparc_variables/substitutions.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
from pydantic import BaseModel
2424
from servicelib.fastapi.app_state import SingletonInAppStateMixin
2525
from servicelib.logging_utils import log_context
26-
from servicelib.rabbitmq.rpc_interfaces.webserver.products import get_product_host
26+
from servicelib.rabbitmq.rpc_interfaces.webserver.products import get_product_base_url
2727

28-
from ...core.settings import get_application_settings
2928
from ...modules.rabbitmq import get_rabbitmq_rpc_client
3029
from ...utils.db import get_repository
3130
from ...utils.osparc_variables import (
@@ -43,7 +42,7 @@
4342

4443

4544
def _make_api_server_base_url(base_url: str):
46-
pass
45+
return f"api.{base_url}"
4746

4847

4948
async def substitute_vendor_secrets_in_model(
@@ -200,7 +199,6 @@ async def resolve_and_substitute_session_variables_in_model(
200199
# if it raises an error vars need replacement
201200
raise_if_unresolved_osparc_variable_identifier_found(model)
202201
except UnresolvedOsparcVariableIdentifierError:
203-
api_server_base_url = get_application_settings(app)
204202
table = OsparcSessionVariablesTable.get_from_app_state(app)
205203
identifiers = await resolve_variables_from_context(
206204
table.copy(),
@@ -212,9 +210,11 @@ async def resolve_and_substitute_session_variables_in_model(
212210
node_id=node_id,
213211
run_id=service_run_id,
214212
wallet_id=wallet_id,
215-
api_server_base_url=get_product_host(
216-
get_rabbitmq_rpc_client(app),
217-
product_name=product_name,
213+
api_server_base_url=_make_api_server_base_url(
214+
await get_product_base_url(
215+
get_rabbitmq_rpc_client(app),
216+
product_name=product_name,
217+
),
218218
),
219219
),
220220
)
@@ -260,9 +260,11 @@ async def resolve_and_substitute_session_variables_in_specs(
260260
node_id=node_id,
261261
run_id=service_run_id,
262262
wallet_id=wallet_id,
263-
api_server_base_url=get_product_host(
264-
get_rabbitmq_rpc_client(app),
265-
product_name=product_name,
263+
api_server_base_url=_make_api_server_base_url(
264+
await get_product_base_url(
265+
get_rabbitmq_rpc_client(app),
266+
product_name=product_name,
267+
),
266268
),
267269
),
268270
)

services/web/server/src/simcore_service_webserver/products/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ProductTemplateNotFoundError(ProductError):
2525

2626

2727
class ProductBaseUrlNotFoundError(ProductError):
28-
msg_template = "Missing host for product {product_name}"
28+
msg_template = "Missing base url for product {product_name}"
2929

3030

3131
class MissingStripeConfigError(ProductError):

0 commit comments

Comments
 (0)