From fff8584737f74b0213c9f1eced1c3131514a2dd0 Mon Sep 17 00:00:00 2001 From: n-kakuko <168174573+n-kakuko@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:34:45 +0900 Subject: [PATCH] =?UTF-8?q?XXX=5FFETCHED=20=E3=81=AE=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/oqtopus_cloud/user/routers/tasks.py | 24 +++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/backend/oqtopus_cloud/user/routers/tasks.py b/backend/oqtopus_cloud/user/routers/tasks.py index 83253d6..392ee41 100644 --- a/backend/oqtopus_cloud/user/routers/tasks.py +++ b/backend/oqtopus_cloud/user/routers/tasks.py @@ -58,10 +58,6 @@ def __init__(self, detail: str): def create_sampling_task_info(task: Task) -> SamplingTaskInfo: status = task.status - if task.status == "QUEUED_FETCHED": - status = "QUEUED" - elif task.status == "CANCELIING_FETCHED": - status = "CANCELLING" return SamplingTaskInfo( taskId=TaskId(task.id), code=task.code, @@ -122,10 +118,6 @@ def serialize_operator(operator: Operator) -> str | BadRequestResponse: def create_estimation_task_info(task: Task) -> EstimationTaskInfo: status = task.status - if task.status == "QUEUED_FETCHED": - status = "QUEUED" - elif task.status == "CANCELIING_FETCHED": - status = "CANCELLING" return EstimationTaskInfo( taskId=TaskId(task.id), @@ -550,10 +542,10 @@ def cancel_sampling_task( if ( task.owner != owner or task.action != "sampling" - or task.status not in ["QUEUED_FETCHED", "QUEUED", "RUNNING"] + or task.status not in ["QUEUED", "RUNNING"] ): return NotFoundErrorResponse( - detail=f"{taskId} task is not in valid status for cancellation (valid statuses for cancellation: 'QUEUED_FETCHED', 'QUEUED' and 'RUNNING')" + detail=f"{taskId} task is not in valid status for cancellation (valid statuses for cancellation: 'QUEUED' and 'RUNNING')" ) if task.status == "QUEUED": logger.info("task is in QUEUED state, so it will be cancelled") @@ -562,9 +554,9 @@ def cancel_sampling_task( ) db.add(result) db.commit() - elif task.status in ["QUEUED_FETCHED", "RUNNING"]: + elif task.status in ["RUNNING"]: logger.info( - "task is in QUEUED_FETCHED or RUNNING state, so it will be marked as CANCELLING" + "task is in RUNNING state, so it will be marked as CANCELLING" ) task.status = "CANCELLING" db.commit() @@ -868,10 +860,10 @@ def cancel_estimation_task( if ( task.owner != owner or task.action != "estimation" - or task.status not in ["QUEUED_FETCHED", "QUEUED", "RUNNING"] + or task.status not in ["QUEUED", "RUNNING"] ): return NotFoundErrorResponse( - detail=f"{taskId} task is not in valid status for cancellation (valid statuses for cancellation: 'QUEUED_FETCHED', 'QUEUED' and 'RUNNING')" + detail=f"{taskId} task is not in valid status for cancellation (valid statuses for cancellation: 'QUEUED' and 'RUNNING')" ) if task.status == "QUEUED": logger.info("task is in QUEUED state, so it will be cancelled") @@ -880,9 +872,9 @@ def cancel_estimation_task( ) db.add(result) db.commit() - elif task.status in ["QUEUED_FETCHED", "RUNNING"]: + elif task.status in ["RUNNING"]: logger.info( - "task is in QUEUED_FETCHED or RUNNING state, so it will be marked as CANCELLING" + "task is in RUNNING state, so it will be marked as CANCELLING" ) task.status = "CANCELLING" db.commit()