File tree Expand file tree Collapse file tree 3 files changed +17
-15
lines changed
director-v2/src/simcore_service_director_v2/api/rpc
src/simcore_service_webserver/director_v2 Expand file tree Collapse file tree 3 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 1414from models_library .services_types import ServiceRunID
1515from models_library .users import UserID
1616from servicelib .rabbitmq import RPCRouter
17- from simcore_postgres_database .models import comp_runs
1817from simcore_service_director_v2 .models .comp_tasks import ComputationTaskForRpcDBGet
1918
2019from ...modules .db .repositories .comp_runs import CompRunsRepository
@@ -37,15 +36,17 @@ async def list_computations_latest_iteration_page(
3736 order_by : OrderBy | None = None ,
3837) -> ComputationRunRpcGetPage :
3938 comp_runs_repo = CompRunsRepository .instance (db_engine = app .state .engine )
40- total , comp_runs = await comp_runs_repo .list_for_user__only_latest_iterations (
41- product_name = product_name ,
42- user_id = user_id ,
43- offset = offset ,
44- limit = limit ,
45- order_by = order_by ,
39+ total , comp_runs_output = (
40+ await comp_runs_repo .list_for_user__only_latest_iterations (
41+ product_name = product_name ,
42+ user_id = user_id ,
43+ offset = offset ,
44+ limit = limit ,
45+ order_by = order_by ,
46+ )
4647 )
4748 return ComputationRunRpcGetPage (
48- items = comp_runs ,
49+ items = comp_runs_output ,
4950 total = total ,
5051 )
5152
Original file line number Diff line number Diff line change 11import asyncio
2+ from decimal import Decimal
23
34from aiohttp import web
45from models_library .api_schemas_directorv2 .comp_runs import (
@@ -82,6 +83,7 @@ async def list_computations_latest_iteration_tasks(
8283
8384 _service_run_ids = [item .service_run_id for item in _tasks_get .items ]
8485 _is_product_billable = await is_product_billable (app , product_name = product_name )
86+ _service_run_osparc_credits : list [Decimal | None ]
8587 if _is_product_billable :
8688 # NOTE: MD: can be improved with a single batch call
8789 _service_run_osparc_credits = await asyncio .gather (
Original file line number Diff line number Diff line change @@ -154,18 +154,17 @@ def mock_rpc_list_computations_latest_iteration_tasks(
154154@pytest .fixture
155155def mock_rpc_list_computations_latest_iteration_tasks_page (
156156 mocker : MockerFixture ,
157+ user_project : ProjectDict ,
157158) -> ComputationTaskRpcGetPage :
159+ workbench_ids = list (user_project ["workbench" ].keys ())
160+ example = ComputationTaskRpcGet .model_config ["json_schema_extra" ]["examples" ][0 ]
161+ example ["node_id" ] = workbench_ids [0 ]
162+
158163 return mocker .patch (
159164 "simcore_service_webserver.director_v2._computations_service.computations.list_computations_latest_iteration_tasks_page" ,
160165 spec = True ,
161166 return_value = ComputationTaskRpcGetPage (
162- items = [
163- ComputationTaskRpcGet .model_validate (
164- ComputationTaskRpcGet .model_config ["json_schema_extra" ]["examples" ][
165- 0
166- ]
167- )
168- ],
167+ items = [ComputationTaskRpcGet .model_validate (example )],
169168 total = 1 ,
170169 ),
171170 )
You can’t perform that action at this time.
0 commit comments