@@ -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
@@ -361,8 +361,8 @@ async def create_or_update_or_start_computation( # noqa: PLR0913 # pylint: disa
361361 last_run : CompRunsAtDB | None = None
362362 pipeline_state = RunningState .NOT_STARTED
363363 with contextlib .suppress (ComputationalRunNotFoundError ):
364- last_run = await comp_runs_repo .get (
365- user_id = computation . user_id , project_id = computation .project_id
364+ last_run = await comp_runs_repo .get_latest_run_by_project (
365+ project_id = computation .project_id
366366 )
367367 pipeline_state = last_run .result
368368
@@ -536,8 +536,8 @@ async def stop_computation(
536536 last_run : CompRunsAtDB | None = None
537537 pipeline_state = RunningState .UNKNOWN
538538 with contextlib .suppress (ComputationalRunNotFoundError ):
539- last_run = await comp_runs_repo .get (
540- user_id = computation_stop . user_id , project_id = project_id
539+ last_run = await comp_runs_repo .get_latest_run_by_project (
540+ project_id = project_id
541541 )
542542 pipeline_state = last_run .result
543543 if utils .is_pipeline_running (last_run .result ):
@@ -595,8 +595,8 @@ async def delete_computation(
595595 # check if current state allow to stop the computation
596596 pipeline_state = RunningState .UNKNOWN
597597 with contextlib .suppress (ComputationalRunNotFoundError ):
598- last_run = await comp_runs_repo .get (
599- user_id = computation_stop . user_id , project_id = project_id
598+ last_run = await comp_runs_repo .get_latest_run_by_project (
599+ project_id = project_id
600600 )
601601 pipeline_state = last_run .result
602602 if utils .is_pipeline_running (pipeline_state ):
@@ -630,8 +630,8 @@ def return_last_value(retry_state: Any) -> Any:
630630 before_sleep = before_sleep_log (_logger , logging .INFO ),
631631 )
632632 async def check_pipeline_stopped () -> bool :
633- last_run = await comp_runs_repo .get (
634- user_id = computation_stop . user_id , project_id = project_id
633+ last_run = await comp_runs_repo .get_latest_run_by_project (
634+ project_id = project_id
635635 )
636636 pipeline_state = last_run .result
637637 return utils .is_pipeline_stopped (pipeline_state )
0 commit comments