4848)
4949from servicelib .aiohttp .rest_responses import create_data_response
5050from servicelib .celery .models import OwnerMetadata
51+ from servicelib .celery .tasks .storage import SEARCH_EXECUTION_METADATA , SEARCH_TASK_NAME
5152from servicelib .common_headers import X_FORWARDED_PROTO
5253from servicelib .rabbitmq .rpc_interfaces .storage .paths import (
5354 compute_path_size as remote_compute_path_size ,
5455)
5556from servicelib .rabbitmq .rpc_interfaces .storage .paths import (
5657 delete_paths as remote_delete_paths ,
5758)
58- from servicelib .rabbitmq .rpc_interfaces .storage .simcore_s3 import (
59- start_export_data ,
60- start_search ,
61- )
59+ from servicelib .rabbitmq .rpc_interfaces .storage .simcore_s3 import start_export_data
6260from servicelib .rest_responses import unwrap_envelope
6361from yarl import URL
6462
6563from .._meta import API_VTAG
64+ from ..celery import get_task_manager
6665from ..login .decorators import login_required
6766from ..models import AuthenticatedRequestContext , WebServerOwnerMetadata
6867from ..rabbitmq import get_rabbitmq_rpc_client
@@ -549,15 +548,14 @@ async def search(request: web.Request) -> web.Response:
549548 class _PathParams (BaseModel ):
550549 location_id : Annotated [LocationID , AfterValidator (_allow_only_simcore )]
551550
552- rabbitmq_rpc_client = get_rabbitmq_rpc_client (request .app )
553551 _req_ctx = AuthenticatedRequestContext .model_validate (request )
554552 parse_request_path_parameters_as (_PathParams , request )
555553 search_body = await parse_request_body_as (
556554 model_schema_cls = SearchBodyParams , request = request
557555 )
558556
559- async_job_rpc_get , _ = await start_search (
560- rabbitmq_rpc_client ,
557+ task_uuid = await get_task_manager ( request . app ). submit_task (
558+ SEARCH_EXECUTION_METADATA ,
561559 owner_metadata = OwnerMetadata .model_validate (
562560 WebServerOwnerMetadata (
563561 user_id = _req_ctx .user_id ,
@@ -577,14 +575,15 @@ class _PathParams(BaseModel):
577575 ),
578576 project_id = search_body .filters .project_id ,
579577 )
580- _job_id = f"{ async_job_rpc_get .job_id } "
578+
579+ _task_id = f"{ task_uuid } "
581580 return create_data_response (
582581 TaskGet (
583- task_id = _job_id ,
584- task_name = async_job_rpc_get . job_name ,
585- status_href = f"{ request .url .with_path (str (request .app .router ['get_async_job_status' ].url_for (task_id = _job_id )))} " ,
586- abort_href = f"{ request .url .with_path (str (request .app .router ['cancel_async_job' ].url_for (task_id = _job_id )))} " ,
587- result_stream_href = f"{ request .url .with_path (str (request .app .router ['get_async_job_stream' ].url_for (task_id = _job_id )))} " ,
582+ task_id = _task_id ,
583+ task_name = SEARCH_TASK_NAME ,
584+ status_href = f"{ request .url .with_path (str (request .app .router ['get_async_job_status' ].url_for (task_id = _task_id )))} " ,
585+ abort_href = f"{ request .url .with_path (str (request .app .router ['cancel_async_job' ].url_for (task_id = _task_id )))} " ,
586+ result_stream_href = f"{ request .url .with_path (str (request .app .router ['get_async_job_stream' ].url_for (task_id = _task_id )))} " ,
588587 ),
589588 status = status .HTTP_202_ACCEPTED ,
590589 )
0 commit comments