File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
celery-library/src/celery_library
service-library/src/servicelib/celery Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 77from common_library .async_tools import make_async
88from models_library .progress_bar import ProgressReport
99from servicelib .celery .models import (
10+ TASK_FINAL_STATES ,
1011 Task ,
1112 TaskFilter ,
1213 TaskID ,
@@ -110,6 +111,11 @@ async def _get_task_progress_report(
110111 if progress is not None :
111112 return progress
112113
114+ if task_state in TASK_FINAL_STATES :
115+ return ProgressReport (
116+ actual_value = _MAX_PROGRESS_VALUE , total = _MAX_PROGRESS_VALUE
117+ )
118+
113119 # task is pending
114120 return ProgressReport (
115121 actual_value = _MIN_PROGRESS_VALUE , total = _MAX_PROGRESS_VALUE
Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ class TaskState(StrEnum):
2626 ABORTED = "ABORTED"
2727
2828
29+ TASK_FINAL_STATES = {TaskState .SUCCESS , TaskState .FAILURE , TaskState .ABORTED }
30+
31+
2932class TasksQueue (StrEnum ):
3033 CPU_BOUND = "cpu_bound"
3134 DEFAULT = "default"
@@ -78,9 +81,6 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
7881 model_config = ConfigDict (json_schema_extra = _update_json_schema_extra )
7982
8083
81- _TASK_DONE = {TaskState .SUCCESS , TaskState .FAILURE , TaskState .ABORTED }
82-
83-
8484class TaskInfoStore (Protocol ):
8585 async def create_task (
8686 self ,
@@ -138,4 +138,4 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
138138
139139 @property
140140 def is_done (self ) -> bool :
141- return self .task_state in _TASK_DONE
141+ return self .task_state in TASK_FINAL_STATES
You can’t perform that action at this time.
0 commit comments