1717
1818_logger = logging .getLogger (__name__ )
1919
20- _CELERY_INSPECT_TASK_STATUSES : Final [tuple [str , ...]] = (
21- "active" ,
22- "scheduled" ,
23- )
2420_CELERY_TASK_META_PREFIX : Final [str ] = "celery-task-meta-"
2521_CELERY_STATES_MAPPING : Final [dict [str , TaskState ]] = {
2622 "PENDING" : TaskState .PENDING ,
@@ -117,9 +113,7 @@ def get_task_status(
117113 progress_report = self ._get_progress_report (task_context , task_uuid ),
118114 )
119115
120- async def _get_completed_task_uuids (
121- self , task_context : TaskContext
122- ) -> set [TaskUUID ]:
116+ async def get_task_uuids (self , task_context : TaskContext ) -> set [TaskUUID ]:
123117 search_key = (
124118 _CELERY_TASK_META_PREFIX
125119 + _build_task_id_prefix (task_context )
@@ -131,24 +125,3 @@ async def _get_completed_task_uuids(
131125 ):
132126 keys .add (TaskUUID (f"{ key } " .removeprefix (search_key )))
133127 return keys
134-
135- async def get_task_uuids (self , task_context : TaskContext ) -> set [TaskUUID ]:
136- task_uuids = await self ._get_completed_task_uuids (task_context )
137-
138- task_id_prefix = _build_task_id_prefix (task_context )
139- inspect = self ._celery_app .control .inspect ()
140- for task_inspect_status in _CELERY_INSPECT_TASK_STATUSES :
141- tasks = getattr (inspect , task_inspect_status )() or {}
142-
143- task_uuids .update (
144- TaskUUID (
145- task_info ["id" ].removeprefix (
146- task_id_prefix + _CELERY_TASK_ID_KEY_SEPARATOR
147- )
148- )
149- for tasks_per_worker in tasks .values ()
150- for task_info in tasks_per_worker
151- if "id" in task_info
152- )
153-
154- return task_uuids
0 commit comments