Skip to content

Commit 7800e4b

Browse files
remove inspect
1 parent 84315ea commit 7800e4b

File tree

1 file changed

+1
-28
lines changed
  • services/storage/src/simcore_service_storage/modules/celery

1 file changed

+1
-28
lines changed

services/storage/src/simcore_service_storage/modules/celery/client.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
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

Comments
 (0)