Skip to content

Commit c9296d7

Browse files
authored
🎨Storage: HA (🚨🚨🚨 test with multiple replicas) (#7375)
1 parent 5bbcc74 commit c9296d7

File tree

35 files changed

+1008
-1076
lines changed

35 files changed

+1008
-1076
lines changed

packages/service-library/src/servicelib/fastapi/http_error.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from collections.abc import Awaitable, Callable
23
from typing import TypeVar
34

@@ -10,6 +11,9 @@
1011
from fastapi.responses import JSONResponse
1112
from pydantic import ValidationError
1213

14+
from ..logging_errors import create_troubleshotting_log_kwargs
15+
from ..status_codes_utils import is_5xx_server_error
16+
1317
validation_error_response_definition["properties"] = {
1418
"errors": {
1519
"title": "Validation errors",
@@ -21,6 +25,8 @@
2125

2226
TException = TypeVar("TException")
2327

28+
_logger = logging.getLogger(__name__)
29+
2430

2531
def make_http_error_handler_for_exception(
2632
status_code: int,
@@ -36,12 +42,24 @@ def make_http_error_handler_for_exception(
3642
SEE https://docs.python.org/3/library/exceptions.html#concrete-exceptions
3743
"""
3844

39-
async def _http_error_handler(_: Request, exc: Exception) -> JSONResponse:
45+
async def _http_error_handler(request: Request, exc: Exception) -> JSONResponse:
4046
assert isinstance(exc, exception_cls) # nosec
4147
error_content = {
4248
"errors": error_extractor(exc) if error_extractor else [f"{exc}"]
4349
}
4450

51+
if is_5xx_server_error(status_code):
52+
_logger.exception(
53+
create_troubleshotting_log_kwargs(
54+
"Unexpected error happened in the Resource Usage Tracker. Please contact support.",
55+
error=exc,
56+
error_context={
57+
"request": request,
58+
"request.method": f"{request.method}",
59+
},
60+
)
61+
)
62+
4563
return JSONResponse(
4664
content=jsonable_encoder(
4765
{"error": error_content} if envelope_error else error_content

packages/service-library/src/servicelib/rabbitmq/rpc_interfaces/storage/paths.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
AsyncJobNameData,
66
)
77
from models_library.api_schemas_storage import STORAGE_RPC_NAMESPACE
8+
from models_library.products import ProductName
89
from models_library.projects_nodes_io import LocationID
910
from models_library.rabbitmq_basic_types import RPCMethodName
1011
from models_library.users import UserID
@@ -17,7 +18,7 @@ async def compute_path_size(
1718
client: RabbitMQRPCClient,
1819
*,
1920
user_id: UserID,
20-
product_name: str,
21+
product_name: ProductName,
2122
location_id: LocationID,
2223
path: Path,
2324
) -> tuple[AsyncJobGet, AsyncJobNameData]:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from models_library.api_schemas_rpc_async_jobs.async_jobs import (
2+
AsyncJobGet,
3+
AsyncJobNameData,
4+
)
5+
from models_library.api_schemas_storage import STORAGE_RPC_NAMESPACE
6+
from models_library.api_schemas_storage.storage_schemas import FoldersBody
7+
from models_library.rabbitmq_basic_types import RPCMethodName
8+
from models_library.users import UserID
9+
10+
from ..._client_rpc import RabbitMQRPCClient
11+
from ..async_jobs.async_jobs import submit
12+
13+
14+
async def copy_folders_from_project(
15+
client: RabbitMQRPCClient,
16+
*,
17+
user_id: UserID,
18+
product_name: str,
19+
body: FoldersBody,
20+
) -> tuple[AsyncJobGet, AsyncJobNameData]:
21+
job_id_data = AsyncJobNameData(user_id=user_id, product_name=product_name)
22+
async_job_rpc_get = await submit(
23+
rabbitmq_rpc_client=client,
24+
rpc_namespace=STORAGE_RPC_NAMESPACE,
25+
method_name=RPCMethodName("copy_folders_from_project"),
26+
job_id_data=job_id_data,
27+
body=body,
28+
)
29+
return async_job_rpc_get, job_id_data

packages/simcore-sdk/tests/integration/test_node_data_data_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"rabbit",
3333
"redis",
3434
"storage",
35+
"sto-worker",
3536
]
3637

3738
pytest_simcore_ops_services_selection = [

packages/simcore-sdk/tests/integration/test_node_ports_common_aws_s3_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"rabbit",
2929
"redis",
3030
"storage",
31+
"sto-worker",
3132
]
3233

3334
pytest_simcore_ops_services_selection = [

packages/simcore-sdk/tests/integration/test_node_ports_common_filemanager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"rabbit",
3838
"redis",
3939
"storage",
40+
"sto-worker",
4041
]
4142

4243
pytest_simcore_ops_services_selection = ["minio", "adminer"]

packages/simcore-sdk/tests/integration/test_node_ports_common_r_clone.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"rabbit",
3030
"redis",
3131
"storage",
32+
"sto-worker",
3233
]
3334

3435
pytest_simcore_ops_services_selection = [

packages/simcore-sdk/tests/integration/test_node_ports_v2_nodeports2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"rabbit",
4949
"redis",
5050
"storage",
51+
"sto-worker",
5152
]
5253

5354
pytest_simcore_ops_services_selection = [
@@ -280,7 +281,6 @@ async def test_port_file_accessors(
280281
request: pytest.FixtureRequest,
281282
constant_uuid4: None,
282283
):
283-
284284
if item_value == "symlink_path":
285285
item_value = request.getfixturevalue("symlink_path")
286286
if config_value == "config_value_symlink_path":

services/director-v2/tests/integration/02/test_dynamic_sidecar_nodeports_integration.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"rabbit",
111111
"redis",
112112
"storage",
113+
"sto-worker",
113114
"redis",
114115
]
115116

@@ -934,15 +935,15 @@ async def test_nodeports_integration(
934935
`aioboto` instead of `docker` or `storage-data_manager API`.
935936
"""
936937
# STEP 1
937-
dynamic_services_urls: dict[
938-
str, str
939-
] = await _start_and_wait_for_dynamic_services_ready(
940-
director_v2_client=async_client,
941-
product_name=osparc_product_name,
942-
user_id=current_user["id"],
943-
workbench_dynamic_services=workbench_dynamic_services,
944-
current_study=current_study,
945-
catalog_url=services_endpoint["catalog"],
938+
dynamic_services_urls: dict[str, str] = (
939+
await _start_and_wait_for_dynamic_services_ready(
940+
director_v2_client=async_client,
941+
product_name=osparc_product_name,
942+
user_id=current_user["id"],
943+
workbench_dynamic_services=workbench_dynamic_services,
944+
current_study=current_study,
945+
catalog_url=services_endpoint["catalog"],
946+
)
946947
)
947948

948949
# STEP 2

services/dynamic-sidecar/tests/integration/test_modules_long_running_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"rabbit",
5151
"redis",
5252
"storage",
53+
"sto-worker",
5354
]
5455

5556
pytest_simcore_ops_services_selection = [
@@ -179,7 +180,6 @@ async def restore_legacy_state_archives(
179180
node_id: NodeID,
180181
state_paths_to_legacy_archives: dict[Path, Path],
181182
) -> None:
182-
183183
tasks = []
184184
for legacy_archive_zip in state_paths_to_legacy_archives.values():
185185
s3_path = f"{project_id}/{node_id}/{legacy_archive_zip.name}"

0 commit comments

Comments
 (0)