File tree Expand file tree Collapse file tree 4 files changed +9
-10
lines changed
services/storage/src/simcore_service_storage Expand file tree Collapse file tree 4 files changed +9
-10
lines changed Original file line number Diff line number Diff line change 1- import asyncio
21import logging
32from collections .abc import Callable
43from math import ceil
@@ -73,7 +72,7 @@ async def _request(
7372 except aiohttp .ClientResponseError as exc :
7473 raise _DatcoreAdapterResponseError (status = exc .status , reason = f"{ exc } " ) from exc
7574
76- except asyncio . TimeoutError as exc :
75+ except TimeoutError as exc :
7776 msg = f"datcore-adapter server timed-out: { exc } "
7877 raise DatcoreAdapterTimeoutError (msg ) from exc
7978
@@ -122,7 +121,7 @@ async def check_service_health(app: web.Application) -> bool:
122121 session : ClientSession = get_client_session (app )
123122 try :
124123 await session .get (url , raise_for_status = True )
125- except (asyncio . TimeoutError , aiohttp .ClientError ):
124+ except (TimeoutError , aiohttp .ClientError ):
126125 return False
127126 return True
128127
@@ -187,7 +186,7 @@ async def list_all_files_metadatas_in_dataset(
187186 ),
188187 )
189188 return [
190- FileMetaData .construct (
189+ FileMetaData .model_construct (
191190 file_uuid = d ["path" ],
192191 location_id = DATCORE_ID ,
193192 location = DATCORE_STR ,
Original file line number Diff line number Diff line change @@ -31,13 +31,13 @@ async def get_health(request: web.Request) -> web.Response:
3131 assert request # nosec
3232 return web .json_response (
3333 {
34- "data" : HealthCheck .parse_obj (
34+ "data" : HealthCheck .model_validate (
3535 {
3636 "name" : PROJECT_NAME ,
3737 "version" : f"{ VERSION } " ,
3838 "api_version" : API_VERSION ,
3939 }
40- ).dict (** RESPONSE_MODEL_POLICY )
40+ ).model_dump (** RESPONSE_MODEL_POLICY )
4141 },
4242 dumps = json_dumps ,
4343 )
@@ -69,7 +69,7 @@ async def get_status(request: web.Request) -> web.Response:
6969 "connected" if await is_pg_responsive (request .app ) else "failed"
7070 )
7171
72- status = AppStatusCheck .parse_obj (
72+ status = AppStatusCheck .model_validate (
7373 {
7474 "app_name" : PROJECT_NAME ,
7575 "version" : f"{ VERSION } " ,
@@ -84,5 +84,5 @@ async def get_status(request: web.Request) -> web.Response:
8484 )
8585
8686 return web .json_response (
87- {"data" : status .dict (exclude_unset = True )}, dumps = json_dumps
87+ {"data" : status .model_dump (exclude_unset = True )}, dumps = json_dumps
8888 )
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ async def get_or_create_temporary_s3_access(request: web.Request) -> web.Respons
5353 s3_settings : S3Settings = await sts .get_or_create_temporary_token_for_user (
5454 request .app , query_params .user_id
5555 )
56- return web .json_response ({"data" : s3_settings .dict ()}, dumps = json_dumps )
56+ return web .json_response ({"data" : s3_settings .model_dump ()}, dumps = json_dumps )
5757
5858
5959async def _copy_folders_from_project (
Original file line number Diff line number Diff line change 1616
1717def convert_db_to_model (x : FileMetaDataAtDB ) -> FileMetaData :
1818 model : FileMetaData = FileMetaData .parse_obj (
19- x .dict ()
19+ x .model_dump ()
2020 | {
2121 "file_uuid" : x .file_id ,
2222 "file_name" : x .file_id .split ("/" )[- 1 ],
You can’t perform that action at this time.
0 commit comments