Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c7c16c4
✨ Implement WebServer RPC Client and subclients for projects, license…
pcrespov Sep 26, 2025
30ead76
✨ Add project job management methods and refactor existing project RP…
pcrespov Sep 26, 2025
cd525cb
✨ Refactor RPC API methods in functions, licenses, and projects modul…
pcrespov Sep 26, 2025
c7f6f85
✨ Add ApiKeysRpcApi subclient and integrate it into WebServerRpcClient
pcrespov Sep 26, 2025
a5c61ee
adatps tests
pcrespov Sep 26, 2025
706a1fe
comments
pcrespov Sep 26, 2025
c3d7f60
sets up WEBSERVER_RPC_NAMESPACE
pcrespov Sep 29, 2025
dfa664b
webserver client side
pcrespov Sep 29, 2025
29e857f
✨ Update WEBSERVER_RPC_NAMESPACE usage and improve settings documenta…
pcrespov Sep 29, 2025
737b408
tests projects rpc
pcrespov Sep 29, 2025
09b8cc3
add deprecation
pcrespov Sep 29, 2025
7eeacba
refactor: replace functions_rpc_interface with _rpc_client for functi…
pcrespov Sep 29, 2025
ed50c91
updates licenserRpcAPI
pcrespov Sep 29, 2025
a1677d0
udpates warnings
pcrespov Sep 29, 2025
c837c57
refactor: update RPC client usage and service name in tests
pcrespov Sep 29, 2025
a5672e2
refactor: update RPC client usage in function tests
pcrespov Sep 29, 2025
4381273
refactor: update licensed items RPC client usage in wb_api_server
pcrespov Sep 29, 2025
9aa7089
context for wb-api-server
pcrespov Sep 29, 2025
9eadee2
refactor: update RPC client usage in license checkout tests
pcrespov Sep 29, 2025
4ce9782
refactor: update RPC client variable name in setup function
pcrespov Sep 29, 2025
b597fd8
cleanup fixtures
pcrespov Sep 29, 2025
b92d64f
adds WEBSERVER_RPC_NAMESPACE
pcrespov Sep 29, 2025
7d275d8
notes
pcrespov Sep 29, 2025
cc7a424
rm rabbit client
pcrespov Sep 30, 2025
5ad4142
refactor: rename mocked_rpc_client to mocked_rabbit_rpc_client for cl…
pcrespov Sep 30, 2025
22e1307
Refactor WbApiRpcClient setup and update test fixtures
pcrespov Sep 30, 2025
3f505da
refactor: update import path for RabbitMQRPCClient in test file
pcrespov Sep 30, 2025
c5f3d6e
mypy fixes
pcrespov Oct 1, 2025
158cbec
tsts
pcrespov Oct 1, 2025
c8aca66
refactor: update service_name fixture and logging in environment mocks
pcrespov Oct 1, 2025
6f0f1de
refactor fixtures in licensing
pcrespov Oct 1, 2025
2429c23
refactor: update environment mock fixtures and add WEBSERVER_RPC_NAME…
pcrespov Oct 1, 2025
4af7f81
@GitHK review: validate returns
pcrespov Oct 1, 2025
fc87e78
@GitHK review: doc
pcrespov Oct 1, 2025
0d91088
refactor: enhance fixture definitions and environment setup for garba…
pcrespov Oct 1, 2025
d19b7d0
refactor: improve initialization of WebserverRpcSideEffects and updat…
pcrespov Oct 1, 2025
cc970a4
rename rpc namespace
pcrespov Oct 1, 2025
54748e7
request options
pcrespov Oct 1, 2025
1e7ae3b
adds https://github.com/ITISFoundation/osparc-simcore/pull/8440
pcrespov Oct 1, 2025
7d56e7b
fixes issues with fixture
pcrespov Oct 1, 2025
e93110d
fixes pylint
pcrespov Oct 1, 2025
508d822
refactor: enhance app_environment fixture to include docker compose s…
pcrespov Oct 1, 2025
3dcfbc4
feat: add HandlerMockFactory for improved mock handling in tests
pcrespov Oct 1, 2025
52b2604
fixing tests
pcrespov Oct 1, 2025
e7e9666
fixing mocks
pcrespov Oct 1, 2025
1d1bb79
fix: update RPC namespace from 'webserver' to 'wb-api-server' in job …
pcrespov Oct 1, 2025
e518cfd
refactor: rename mock dependencies for clarity and consistency in tests
pcrespov Oct 1, 2025
ac38fa6
revert WEBSERVER_SOCKETIO: 0
pcrespov Oct 1, 2025
c2e9be5
fix: update WEBSERVER_RPC_NAMESPACE in tests to ensure correct enviro…
pcrespov Oct 1, 2025
6dd36d9
only add _rpc_request_kwargs once (#81)
bisgaard-itis Oct 1, 2025
ba61472
add rpc namespace in garbage collector and in event-listener
bisgaard-itis Oct 2, 2025
63b5e36
minor improvements
bisgaard-itis Oct 2, 2025
46e8db9
fix for webserver tests
bisgaard-itis Oct 2, 2025
bfa9879
refactor: improve mocking utilities for RPC interfaces in tests
pcrespov Oct 3, 2025
51479d1
refactor: rename mock_function_factory to create_fake_function_obj fo…
pcrespov Oct 3, 2025
5ad7192
fix env
bisgaard-itis Oct 3, 2025
c95d0f3
🎨 `TaskID` -> `TaskKey` (#8409)
bisgaard-itis Oct 3, 2025
a5907a6
Merge branch 'master' into fix/many-webservers-rpc
pcrespov Oct 3, 2025
85fd3f8
fixing app_environs
pcrespov Oct 3, 2025
cbf77c2
bad import
pcrespov Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from ..rabbitmq_basic_types import RPCNamespace

WEBSERVER_RPC_NAMESPACE: Final[RPCNamespace] = TypeAdapter(
DEFAULT_WEBSERVER_RPC_NAMESPACE: Final[RPCNamespace] = TypeAdapter(
# NOTE: deprecated! Use app.state.settings.WEBSERVER_RPC_NAMESPACE
RPCNamespace
).validate_python("webserver")
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from models_library.basic_types import IDStr
from models_library.resource_tracker import PricingPlanId
from pydantic import BaseModel, ConfigDict, HttpUrl, PositiveInt
from pydantic import BaseModel, ConfigDict, HttpUrl, NonNegativeInt, PositiveInt
from pydantic.config import JsonDict
from typing_extensions import TypedDict

Expand Down Expand Up @@ -94,7 +94,7 @@ class LicensedItemRpcGet(BaseModel):

class LicensedItemRpcGetPage(NamedTuple):
items: list[LicensedItemRpcGet]
total: PositiveInt
total: NonNegativeInt


# Rest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from ...api_schemas_webserver import DEFAULT_WEBSERVER_RPC_NAMESPACE

__all__: tuple[str, ...] = ("DEFAULT_WEBSERVER_RPC_NAMESPACE",)
# nopycln" file
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from collections.abc import Callable
from typing import Any, Protocol

from pytest_mock import MockType


class HandlerMockFactory(Protocol):
def __call__(
self,
handler_name: str,
return_value: Any = None,
exception: Exception | None = None,
side_effect: Callable | None = None,
) -> MockType: ...
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@
class WebserverRpcSideEffects:
# pylint: disable=no-self-use

def __init__(
self,
project_job_rpc_get: ProjectJobRpcGet = ProjectJobRpcGet.model_validate(
ProjectJobRpcGet.model_json_schema()["examples"][0]
),
):
self.project_job_rpc_get = project_job_rpc_get
def __init__(self, fake_project_job_rpc_get: ProjectJobRpcGet):
self.fake_project_job_rpc_get = fake_project_job_rpc_get

@validate_call(config={"arbitrary_types_allowed": True})
async def mark_project_as_job(
Expand Down Expand Up @@ -112,7 +107,7 @@ async def get_project_marked_as_job(
assert job_parent_resource_name

# Return a valid example from the schema
_data = self.project_job_rpc_get.model_dump()
_data = self.fake_project_job_rpc_get.model_dump()
_data["uuid"] = str(project_uuid)
_data["job_parent_resource_name"] = job_parent_resource_name
return ProjectJobRpcGet.model_validate(_data)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import warnings

from models_library.api_schemas_webserver import WEBSERVER_RPC_NAMESPACE
from models_library.api_schemas_webserver import DEFAULT_WEBSERVER_RPC_NAMESPACE
from models_library.basic_types import IDStr
from models_library.rabbitmq_basic_types import RPCMethodName
from models_library.rpc.webserver.auth.api_keys import ApiKeyCreate, ApiKeyGet
Expand All @@ -12,6 +13,13 @@

_logger = logging.getLogger(__name__)

warnings.warn(
f"The '{__name__}' module is deprecated and will be removed in a future release. "
"Please use 'rpc_interfaces.webserver.v1' instead.",
DeprecationWarning,
stacklevel=2,
)


@log_decorator(_logger, level=logging.DEBUG)
async def create_api_key(
Expand All @@ -22,7 +30,7 @@ async def create_api_key(
api_key: ApiKeyCreate,
) -> ApiKeyGet:
result: ApiKeyGet = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("create_api_key"),
user_id=user_id,
product_name=product_name,
Expand All @@ -42,7 +50,7 @@ async def get_api_key(
api_key_id: IDStr,
) -> ApiKeyGet:
result: ApiKeyGet = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_api_key"),
user_id=user_id,
product_name=product_name,
Expand All @@ -61,7 +69,7 @@ async def delete_api_key_by_key(
api_key: str,
) -> None:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("delete_api_key_by_key"),
user_id=user_id,
product_name=product_name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging
import warnings
from typing import Annotated, Literal

from models_library.api_schemas_webserver import WEBSERVER_RPC_NAMESPACE
from models_library.api_schemas_webserver import DEFAULT_WEBSERVER_RPC_NAMESPACE
from models_library.api_schemas_webserver.functions import (
Function,
FunctionID,
Expand Down Expand Up @@ -42,6 +43,14 @@
_FUNCTION_RPC_TIMEOUT_SEC: Annotated[int, PositiveInt] = 30


warnings.warn(
f"The '{__name__}' module is deprecated and will be removed in a future release. "
"Please use 'rpc_interfaces.webserver.v1' instead.",
DeprecationWarning,
stacklevel=2,
)


@log_decorator(_logger, level=logging.DEBUG)
async def register_function(
rabbitmq_rpc_client: RabbitMQRPCClient,
Expand All @@ -51,7 +60,7 @@ async def register_function(
function: Function,
) -> RegisteredFunction:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("register_function"),
function=function,
user_id=user_id,
Expand All @@ -72,7 +81,7 @@ async def get_function(
function_id: FunctionID,
) -> RegisteredFunction:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function"),
function_id=function_id,
user_id=user_id,
Expand All @@ -91,7 +100,7 @@ async def get_function_input_schema(
product_name: ProductName,
) -> FunctionInputSchema:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_input_schema"),
function_id=function_id,
user_id=user_id,
Expand All @@ -110,7 +119,7 @@ async def get_function_output_schema(
product_name: ProductName,
) -> FunctionOutputSchema:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_output_schema"),
function_id=function_id,
user_id=user_id,
Expand All @@ -129,7 +138,7 @@ async def delete_function(
product_name: ProductName,
) -> None:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("delete_function"),
function_id=function_id,
user_id=user_id,
Expand All @@ -155,7 +164,7 @@ async def list_functions(
) -> tuple[list[RegisteredFunction], PageMetaInfoLimitOffset]:
result: tuple[list[RegisteredFunction], PageMetaInfoLimitOffset] = (
await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("list_functions"),
pagination_offset=pagination_offset,
pagination_limit=pagination_limit,
Expand Down Expand Up @@ -187,7 +196,7 @@ async def list_function_jobs(
) -> tuple[list[RegisteredFunctionJob], PageMetaInfoLimitOffset]:
result: tuple[list[RegisteredFunctionJob], PageMetaInfoLimitOffset] = (
await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("list_function_jobs"),
user_id=user_id,
product_name=product_name,
Expand Down Expand Up @@ -220,7 +229,7 @@ async def list_function_jobs_with_status(
PageMetaInfoLimitOffset,
]:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("list_function_jobs_with_status"),
user_id=user_id,
product_name=product_name,
Expand Down Expand Up @@ -250,7 +259,7 @@ async def list_function_job_collections(
filters: FunctionJobCollectionsListFilters | None = None,
) -> tuple[list[RegisteredFunctionJobCollection], PageMetaInfoLimitOffset]:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("list_function_job_collections"),
pagination_offset=pagination_offset,
pagination_limit=pagination_limit,
Expand All @@ -274,7 +283,7 @@ async def update_function_title(
title: str,
) -> RegisteredFunction:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("update_function_title"),
function_id=function_id,
title=title,
Expand All @@ -295,7 +304,7 @@ async def update_function_description(
description: str,
) -> RegisteredFunction:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("update_function_description"),
function_id=function_id,
description=description,
Expand All @@ -316,7 +325,7 @@ async def run_function(
product_name: ProductName,
) -> RegisteredFunctionJob:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("run_function"),
function_id=function_id,
inputs=inputs,
Expand All @@ -338,7 +347,7 @@ async def register_function_job(
function_job: FunctionJob,
) -> RegisteredFunctionJob:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("register_function_job"),
function_job=function_job,
user_id=user_id,
Expand All @@ -360,7 +369,7 @@ async def patch_registered_function_job(
registered_function_job_patch: RegisteredFunctionJobPatch,
) -> RegisteredFunctionJob:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("patch_registered_function_job"),
user_id=user_id,
product_name=product_name,
Expand All @@ -382,7 +391,7 @@ async def get_function_job(
product_name: ProductName,
) -> RegisteredFunctionJob:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_job"),
function_job_id=function_job_id,
user_id=user_id,
Expand All @@ -402,7 +411,7 @@ async def get_function_job_status(
product_name: ProductName,
) -> FunctionJobStatus:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_job_status"),
function_job_id=function_job_id,
user_id=user_id,
Expand All @@ -421,7 +430,7 @@ async def get_function_job_outputs(
product_name: ProductName,
) -> FunctionOutputs:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_job_outputs"),
function_job_id=function_job_id,
user_id=user_id,
Expand All @@ -442,7 +451,7 @@ async def update_function_job_status(
check_write_permissions: bool = True,
) -> FunctionJobStatus:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("update_function_job_status"),
function_job_id=function_job_id,
job_status=job_status,
Expand All @@ -465,7 +474,7 @@ async def update_function_job_outputs(
check_write_permissions: bool = True,
) -> FunctionOutputs:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("update_function_job_outputs"),
function_job_id=function_job_id,
outputs=outputs,
Expand All @@ -486,7 +495,7 @@ async def delete_function_job(
function_job_id: FunctionJobID,
) -> None:
result: None = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("delete_function_job"),
function_job_id=function_job_id,
user_id=user_id,
Expand All @@ -506,7 +515,7 @@ async def find_cached_function_jobs(
inputs: FunctionInputs,
) -> list[RegisteredFunctionJob] | None:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("find_cached_function_jobs"),
function_id=function_id,
inputs=inputs,
Expand All @@ -528,7 +537,7 @@ async def register_function_job_collection(
function_job_collection: FunctionJobCollection,
) -> RegisteredFunctionJobCollection:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("register_function_job_collection"),
function_job_collection=function_job_collection,
user_id=user_id,
Expand All @@ -547,7 +556,7 @@ async def get_function_job_collection(
product_name: ProductName,
) -> RegisteredFunctionJobCollection:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_job_collection"),
function_job_collection_id=function_job_collection_id,
user_id=user_id,
Expand All @@ -566,7 +575,7 @@ async def delete_function_job_collection(
function_job_collection_id: FunctionJobCollectionID,
) -> None:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("delete_function_job_collection"),
function_job_collection_id=function_job_collection_id,
user_id=user_id,
Expand All @@ -585,7 +594,7 @@ async def get_function_user_permissions(
function_id: FunctionID,
) -> FunctionUserAccessRights:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("get_function_user_permissions"),
function_id=function_id,
user_id=user_id,
Expand All @@ -603,7 +612,7 @@ async def get_functions_user_api_access_rights(
product_name: ProductName,
) -> FunctionUserApiAccessRights:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python(
"get_functions_user_api_access_rights"
),
Expand Down Expand Up @@ -632,7 +641,7 @@ async def set_group_permissions(
]
]:
result = await rabbitmq_rpc_client.request(
WEBSERVER_RPC_NAMESPACE,
DEFAULT_WEBSERVER_RPC_NAMESPACE,
TypeAdapter(RPCMethodName).validate_python("set_group_permissions"),
user_id=user_id,
product_name=product_name,
Expand Down
Loading
Loading