2727from ...products import products_web
2828from ...security .decorators import permission_required
2929from ...utils_aiohttp import envelope_json_response
30- from .. import _client , _service
30+ from .. import _service
31+ from .._client import DirectorV2RestClient
3132from .._service_abc import CommitID , get_project_run_policy
3233from ._rest_exceptions import handle_rest_requests_exceptions
3334
@@ -106,10 +107,12 @@ async def start_computation(request: web.Request) -> web.Response:
106107 else True
107108 )
108109
109- computations = _client . ComputationsApi (request .app )
110+ computations = DirectorV2RestClient (request .app )
110111 _started_pipelines_ids = await asyncio .gather (
111112 * [
112- computations .start (pid , req_ctx .user_id , req_ctx .product_name , ** options )
113+ computations .start_computation (
114+ pid , req_ctx .user_id , req_ctx .product_name , ** options
115+ )
113116 for pid in running_project_ids
114117 ]
115118 )
@@ -134,7 +137,7 @@ async def start_computation(request: web.Request) -> web.Response:
134137@handle_rest_requests_exceptions
135138async def stop_computation (request : web .Request ) -> web .Response :
136139 req_ctx = RequestContext .model_validate (request )
137- computations = _client . ComputationsApi (request .app )
140+ computations = DirectorV2RestClient (request .app )
138141 run_policy = get_project_run_policy (request .app )
139142 assert run_policy # nosec
140143
@@ -148,7 +151,7 @@ async def stop_computation(request: web.Request) -> web.Response:
148151 )
149152
150153 await asyncio .gather (
151- * [computations .stop (pid , req_ctx .user_id ) for pid in project_ids ]
154+ * [computations .stop_computation (pid , req_ctx .user_id ) for pid in project_ids ]
152155 )
153156 return web .json_response (status = status .HTTP_204_NO_CONTENT )
154157
@@ -159,7 +162,7 @@ async def stop_computation(request: web.Request) -> web.Response:
159162@permission_required ("project.read" )
160163@handle_rest_requests_exceptions
161164async def get_computation (request : web .Request ) -> web .Response :
162- computations = _client . ComputationsApi (request .app )
165+ computations = DirectorV2RestClient (request .app )
163166 run_policy = get_project_run_policy (request .app )
164167 assert run_policy # nosec
165168
@@ -175,7 +178,10 @@ async def get_computation(request: web.Request) -> web.Response:
175178 )
176179
177180 list_computation_tasks = await asyncio .gather (
178- * [computations .get (project_id = pid , user_id = user_id ) for pid in project_ids ]
181+ * [
182+ computations .get_computation (project_id = pid , user_id = user_id )
183+ for pid in project_ids
184+ ]
179185 )
180186
181187 assert len (list_computation_tasks ) == len (project_ids ) # nosec
0 commit comments