@@ -97,8 +97,8 @@ async def _check_pipeline_not_running_or_raise_409(
9797 computation : ComputationCreate ,
9898) -> None :
9999 with contextlib .suppress (ComputationalRunNotFoundError ):
100- last_run = await comp_runs_repo .get (
101- user_id = computation . user_id , project_id = computation .project_id
100+ last_run = await comp_runs_repo .get_latest_run_by_project (
101+ project_id = computation .project_id
102102 )
103103 pipeline_state = last_run .result
104104
@@ -367,8 +367,8 @@ async def create_or_update_or_start_computation( # noqa: PLR0913 # pylint: disa
367367 last_run : CompRunsAtDB | None = None
368368 pipeline_state = RunningState .NOT_STARTED
369369 with contextlib .suppress (ComputationalRunNotFoundError ):
370- last_run = await comp_runs_repo .get (
371- user_id = computation . user_id , project_id = computation .project_id
370+ last_run = await comp_runs_repo .get_latest_run_by_project (
371+ project_id = computation .project_id
372372 )
373373 pipeline_state = last_run .result
374374
@@ -542,8 +542,8 @@ async def stop_computation(
542542 last_run : CompRunsAtDB | None = None
543543 pipeline_state = RunningState .UNKNOWN
544544 with contextlib .suppress (ComputationalRunNotFoundError ):
545- last_run = await comp_runs_repo .get (
546- user_id = computation_stop . user_id , project_id = project_id
545+ last_run = await comp_runs_repo .get_latest_run_by_project (
546+ project_id = project_id
547547 )
548548 pipeline_state = last_run .result
549549 if utils .is_pipeline_running (last_run .result ):
@@ -601,8 +601,8 @@ async def delete_computation(
601601 # check if current state allow to stop the computation
602602 pipeline_state = RunningState .UNKNOWN
603603 with contextlib .suppress (ComputationalRunNotFoundError ):
604- last_run = await comp_runs_repo .get (
605- user_id = computation_stop . user_id , project_id = project_id
604+ last_run = await comp_runs_repo .get_latest_run_by_project (
605+ project_id = project_id
606606 )
607607 pipeline_state = last_run .result
608608 if utils .is_pipeline_running (pipeline_state ):
@@ -636,8 +636,8 @@ def return_last_value(retry_state: Any) -> Any:
636636 before_sleep = before_sleep_log (_logger , logging .INFO ),
637637 )
638638 async def check_pipeline_stopped () -> bool :
639- last_run = await comp_runs_repo .get (
640- user_id = computation_stop . user_id , project_id = project_id
639+ last_run = await comp_runs_repo .get_latest_run_by_project (
640+ project_id = project_id
641641 )
642642 pipeline_state = last_run .result
643643 return utils .is_pipeline_stopped (pipeline_state )
0 commit comments