Skip to content

Commit 25f4c38

Browse files
committed
refactor
1 parent d33057d commit 25f4c38

File tree

13 files changed

+24
-28
lines changed

13 files changed

+24
-28
lines changed

api/specs/storage/openapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ async def get_files_metadata_dataset(
126126
f"/{API_VTAG}/locations",
127127
response_model=list[DatasetMetaData],
128128
tags=TAGS_LOCATIONS,
129-
operation_id="get_storage_locations",
129+
operation_id="list_storage_locations",
130130
summary="Get available storage locations",
131131
)
132-
async def get_storage_locations(user_id: UserID):
132+
async def list_storage_locations(user_id: UserID):
133133
"""Returns the list of available storage locations"""
134134

135135

api/specs/web-server/_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
response_model=list[DatasetMetaData],
4242
summary="Get available storage locations",
4343
)
44-
async def get_storage_locations():
44+
async def list_storage_locations():
4545
"""Returns the list of available storage locations"""
4646

4747

packages/simcore-sdk/src/simcore_sdk/node_ports_common/_filemanager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def _get_location_id_from_location_name(
3434
store: LocationName,
3535
session: ClientSession,
3636
) -> LocationID:
37-
resp = await storage_client.get_storage_locations(session=session, user_id=user_id)
37+
resp = await storage_client.list_storage_locations(session=session, user_id=user_id)
3838
for location in resp:
3939
if location.name == store:
4040
return cast(LocationID, location.id) # mypy wants it

packages/simcore-sdk/src/simcore_sdk/node_ports_common/storage_client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747

4848
def handle_client_exception(
49-
handler: Callable[P, Coroutine[Any, Any, R]]
49+
handler: Callable[P, Coroutine[Any, Any, R]],
5050
) -> Callable[P, Coroutine[Any, Any, R]]:
5151
@wraps(handler)
5252
async def wrapped(*args: P.args, **kwargs: P.kwargs) -> R:
@@ -134,7 +134,7 @@ async def retry_request(
134134

135135

136136
@handle_client_exception
137-
async def get_storage_locations(
137+
async def list_storage_locations(
138138
*, session: ClientSession, user_id: UserID
139139
) -> FileLocationArray:
140140
async with retry_request(
@@ -239,7 +239,6 @@ async def get_file_metadata(
239239
expected_status=status.HTTP_200_OK,
240240
params={"user_id": f"{user_id}"},
241241
) as response:
242-
243242
payload = await response.json()
244243
if not payload.get("data"):
245244
# NOTE: keeps backwards compatibility

packages/simcore-sdk/tests/unit/test_storage_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
delete_file,
3131
get_download_file_link,
3232
get_file_metadata,
33-
get_storage_locations,
3433
get_upload_file_links,
3534
list_file_metadata,
35+
list_storage_locations,
3636
)
3737
from simcore_sdk.node_ports_common.storage_endpoint import (
3838
get_base_url,
@@ -92,14 +92,14 @@ async def session() -> AsyncIterator[aiohttp.ClientSession]:
9292
yield session
9393

9494

95-
async def test_get_storage_locations(
95+
async def test_list_storage_locations(
9696
clear_caches: None,
9797
storage_v0_service_mock: AioResponsesMock,
9898
mock_postgres: EnvVarsDict,
9999
session: aiohttp.ClientSession,
100100
user_id: UserID,
101101
):
102-
result = await get_storage_locations(session=session, user_id=user_id)
102+
result = await list_storage_locations(session=session, user_id=user_id)
103103
assert isinstance(result, FileLocationArray) # type: ignore
104104

105105
assert len(result) == 1

services/director-v2/tests/unit/with_dbs/comp_scheduler/test_api_route_computations_tasks.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ class Loc(NamedTuple):
9292
autospec=True,
9393
return_value=faker.url(),
9494
),
95-
"get_storage_locations": mocker.patch(
96-
"simcore_sdk.node_ports_common.storage_client.get_storage_locations",
95+
"list_storage_locations": mocker.patch(
96+
"simcore_sdk.node_ports_common.storage_client.list_storage_locations",
9797
autospec=True,
9898
return_value=[
9999
Loc(name="simcore.s3", id=0),
@@ -159,7 +159,7 @@ async def test_get_all_tasks_log_files(
159159
)
160160

161161
# calls storage
162-
mocked_nodeports_storage_client["get_storage_locations"].assert_not_called()
162+
mocked_nodeports_storage_client["list_storage_locations"].assert_not_called()
163163
assert mocked_nodeports_storage_client["get_download_file_link"].called
164164

165165
# test expected response according to OAS!
@@ -207,7 +207,6 @@ async def test_get_tasks_outputs(
207207

208208

209209
async def test_get_tasks_outputs_not_found(node_id: NodeID, client: httpx.AsyncClient):
210-
211210
invalid_project = uuid4()
212211
resp = await client.post(
213212
f"/v2/computations/{invalid_project}/tasks/-/outputs:batchGet",

services/storage/src/simcore_service_storage/api/v0/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ paths:
101101
- locations
102102
summary: Get available storage locations
103103
description: Returns the list of available storage locations
104-
operationId: get_storage_locations
104+
operationId: list_storage_locations
105105
parameters:
106106
- name: user_id
107107
in: query

services/storage/src/simcore_service_storage/handlers_locations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030

3131

3232
# HANDLERS ---------------------------------------------------
33-
@routes.get(f"/{API_VTAG}/locations", name="get_storage_locations")
34-
async def get_storage_locations(request: web.Request) -> web.Response:
33+
@routes.get(f"/{API_VTAG}/locations", name="list_storage_locations")
34+
async def list_storage_locations(request: web.Request) -> web.Response:
3535
query_params: StorageQueryParamsBase = parse_request_query_parameters_as(
3636
StorageQueryParamsBase, request
3737
)
3838
log.debug(
39-
"received call to get_storage_locations with %s",
39+
"received call to list_storage_locations with %s",
4040
f"{query_params=}",
4141
)
4242
dsm_provider = get_dsm_provider(request.app)

services/storage/tests/unit/test__legacy_storage_sdk_compatibility.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ async def test_storage_client_used_in_simcore_sdk_0_3_2( # noqa: PLR0915
101101
response_payload,
102102
status_code,
103103
response_headers,
104-
) = await api.get_storage_locations_with_http_info(user_id)
104+
) = await api.list_storage_locations_with_http_info(user_id)
105105
print(f"{response_payload=}")
106106
print(f"{status_code=}")
107107
print(f"{response_headers=}")
@@ -145,7 +145,7 @@ async def test_storage_client_used_in_simcore_sdk_0_3_2( # noqa: PLR0915
145145

146146
# _get_location_id_from_location_name
147147
# https://github.com/ITISFoundation/osparc-simcore/blob/cfdf4f86d844ebb362f4f39e9c6571d561b72897/packages/simcore-sdk/src/simcore_sdk/node_ports/filemanager.py#L89
148-
resp_model = await api.get_storage_locations(user_id=user_id)
148+
resp_model = await api.list_storage_locations(user_id=user_id)
149149
print(f"{resp_model=}")
150150
for location in resp_model.data:
151151
assert location["name"] == location_name

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5666,7 +5666,7 @@ paths:
56665666
- storage
56675667
summary: Get available storage locations
56685668
description: Returns the list of available storage locations
5669-
operationId: get_storage_locations
5669+
operationId: list_storage_locations
56705670
responses:
56715671
'200':
56725672
description: Successful Response

0 commit comments

Comments
 (0)