Skip to content

Commit ac9cf2b

Browse files
committed
fixes in storage
1 parent 92115e2 commit ac9cf2b

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

services/storage/src/simcore_service_storage/api/rest/_files.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
from .._worker_tasks._files import complete_upload_file as remote_complete_upload_file
4242
from .dependencies.celery import get_task_manager
4343

44+
_ASYNC_JOB_CLIENT_NAME: Final[str] = "STORAGE"
45+
46+
4447
_logger = logging.getLogger(__name__)
4548

4649
router = APIRouter(
@@ -287,12 +290,13 @@ async def complete_upload_file(
287290
async_job_name_data = AsyncJobFilter(
288291
user_id=query_params.user_id,
289292
product_name=_UNDEFINED_PRODUCT_NAME_FOR_WORKER_TASKS, # NOTE: I would need to change the API here
293+
client_name=_ASYNC_JOB_CLIENT_NAME,
290294
)
291295
task_uuid = await task_manager.submit_task(
292296
TaskMetadata(
293297
name=remote_complete_upload_file.__name__,
294298
),
295-
task_filter=async_job_name_data.model_dump(),
299+
task_filter=async_job_name_data,
296300
user_id=async_job_name_data.user_id,
297301
location_id=location_id,
298302
file_id=file_id,
@@ -343,15 +347,16 @@ async def is_completed_upload_file(
343347
async_job_name_data = AsyncJobFilter(
344348
user_id=query_params.user_id,
345349
product_name=_UNDEFINED_PRODUCT_NAME_FOR_WORKER_TASKS, # NOTE: I would need to change the API here
350+
client_name=_ASYNC_JOB_CLIENT_NAME,
346351
)
347352
task_status = await task_manager.get_task_status(
348-
task_filter=async_job_name_data.model_dump(), task_uuid=TaskUUID(future_id)
353+
task_filter=async_job_name_data, task_uuid=TaskUUID(future_id)
349354
)
350355
# first check if the task is in the app
351356
if task_status.is_done:
352357
task_result = TypeAdapter(FileMetaData).validate_python(
353358
await task_manager.get_task_result(
354-
task_filter=async_job_name_data.model_dump(),
359+
task_filter=async_job_name_data,
355360
task_uuid=TaskUUID(future_id),
356361
)
357362
)

services/storage/src/simcore_service_storage/api/rpc/_paths.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@router.expose(reraise_if_error_type=None)
2121
async def compute_path_size(
2222
task_manager: TaskManager,
23-
job_id_data: AsyncJobFilter,
23+
job_filter: AsyncJobFilter,
2424
location_id: LocationID,
2525
path: Path,
2626
) -> AsyncJobGet:
@@ -29,8 +29,8 @@ async def compute_path_size(
2929
task_metadata=TaskMetadata(
3030
name=task_name,
3131
),
32-
task_filter=job_id_data.model_dump(),
33-
user_id=job_id_data.user_id,
32+
task_filter=job_filter,
33+
user_id=job_filter.user_id,
3434
location_id=location_id,
3535
path=path,
3636
)
@@ -41,7 +41,7 @@ async def compute_path_size(
4141
@router.expose(reraise_if_error_type=None)
4242
async def delete_paths(
4343
task_manager: TaskManager,
44-
job_id_data: AsyncJobFilter,
44+
job_filter: AsyncJobFilter,
4545
location_id: LocationID,
4646
paths: set[Path],
4747
) -> AsyncJobGet:
@@ -50,8 +50,8 @@ async def delete_paths(
5050
task_metadata=TaskMetadata(
5151
name=task_name,
5252
),
53-
task_filter=job_id_data.model_dump(),
54-
user_id=job_id_data.user_id,
53+
task_filter=job_filter,
54+
user_id=job_filter.user_id,
5555
location_id=location_id,
5656
paths=paths,
5757
)

0 commit comments

Comments
 (0)