Skip to content

Commit 4722a4e

Browse files
committed
@GitHK review: remove crap
1 parent daea69b commit 4722a4e

File tree

1 file changed

+19
-23
lines changed
  • services/director-v2/src/simcore_service_director_v2/api/routes

1 file changed

+19
-23
lines changed

services/director-v2/src/simcore_service_director_v2/api/routes/computations.py

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" CRUD operations on a "computation" resource
1+
"""CRUD operations on a "computation" resource
22
33
A computation is a resource that represents a running pipeline of computational services in a give project
44
Therefore,
@@ -15,7 +15,6 @@
1515
# pylint: disable=too-many-arguments
1616
# pylint: disable=too-many-statements
1717

18-
1918
import contextlib
2019
import logging
2120
from typing import Annotated, Any, Final
@@ -551,29 +550,26 @@ async def stop_computation(
551550
)
552551

553552
# get run details if any
554-
async def _create_computation_response() -> ComputationGet:
555-
last_run: CompRunsAtDB | None = None
556-
with contextlib.suppress(ComputationalRunNotFoundError):
557-
last_run = await comp_runs_repo.get(
558-
user_id=computation_stop.user_id, project_id=project_id
559-
)
560-
561-
return ComputationGet(
562-
id=project_id,
563-
state=pipeline_state,
564-
pipeline_details=await compute_pipeline_details(
565-
complete_dag, pipeline_dag, tasks
566-
),
567-
url=TypeAdapter(AnyHttpUrl).validate_python(f"{request.url}"),
568-
stop_url=None,
569-
iteration=last_run.iteration if last_run else None,
570-
result=None,
571-
started=compute_pipeline_started_timestamp(pipeline_dag, tasks),
572-
stopped=compute_pipeline_stopped_timestamp(pipeline_dag, tasks),
573-
submitted=last_run.created if last_run else None,
553+
last_run: CompRunsAtDB | None = None
554+
with contextlib.suppress(ComputationalRunNotFoundError):
555+
last_run = await comp_runs_repo.get(
556+
user_id=computation_stop.user_id, project_id=project_id
574557
)
575558

576-
return await _create_computation_response()
559+
return ComputationGet(
560+
id=project_id,
561+
state=pipeline_state,
562+
pipeline_details=await compute_pipeline_details(
563+
complete_dag, pipeline_dag, tasks
564+
),
565+
url=TypeAdapter(AnyHttpUrl).validate_python(f"{request.url}"),
566+
stop_url=None,
567+
iteration=last_run.iteration if last_run else None,
568+
result=None,
569+
started=compute_pipeline_started_timestamp(pipeline_dag, tasks),
570+
stopped=compute_pipeline_stopped_timestamp(pipeline_dag, tasks),
571+
submitted=last_run.created if last_run else None,
572+
)
577573

578574
except ProjectNotFoundError as e:
579575
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"{e}") from e

0 commit comments

Comments
 (0)