fix: celeryinfo取值错误
This commit is contained in:
parent
c0567f5a55
commit
077707f493
|
@ -108,18 +108,23 @@ class CeleryMonitor:
|
||||||
def get_info(cls):
|
def get_info(cls):
|
||||||
count_active_task = 0
|
count_active_task = 0
|
||||||
count_scheduled_task = 0
|
count_scheduled_task = 0
|
||||||
|
count_registered_task = 0
|
||||||
active_tasks = celery_inspect.active()
|
active_tasks = celery_inspect.active()
|
||||||
if active_tasks:
|
if active_tasks:
|
||||||
_, first_value = active_tasks.popitem()
|
_, first_value = active_tasks.popitem()
|
||||||
count_active_task = len(first_value)
|
count_active_task = len(first_value)
|
||||||
scheduled_tasks = celery_inspect.scheduled()
|
scheduled_tasks = celery_inspect.scheduled()
|
||||||
if scheduled_tasks:
|
if scheduled_tasks:
|
||||||
_, first_value = active_tasks.popitem()
|
_, first_value = scheduled_tasks.popitem()
|
||||||
count_scheduled_task = len(first_value)
|
count_scheduled_task = len(first_value)
|
||||||
print(active_tasks)
|
registered_tasks = celery_inspect.registered()
|
||||||
|
if registered_tasks:
|
||||||
|
_, first_value = registered_tasks.popitem()
|
||||||
|
count_registered_task = len(first_value)
|
||||||
return {
|
return {
|
||||||
'count_active_task': count_active_task,
|
'count_active_task': count_active_task,
|
||||||
'count_scheduled_task': count_scheduled_task,
|
'count_scheduled_task': count_scheduled_task,
|
||||||
|
'count_registered_task': count_registered_task,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue