diff --git a/plugins/celery/celery_tasks b/plugins/celery/celery_tasks index fea350aa..0198d7ef 100755 --- a/plugins/celery/celery_tasks +++ b/plugins/celery/celery_tasks @@ -64,11 +64,13 @@ URL_ENDPOINTS = { 'task_details': '/api/task/name/%s', } TASK_STATES = ( - 'task-accepted', - 'task-received', - 'task-succeeded', - 'task-failed', - 'task-retried', + 'PENDING', + 'RECEIVED', + 'STARTED', + 'SUCCESS', + 'FAILURE', + 'REVOKED', + 'RETRY' ) def get_data(what, api_url, *args): @@ -90,7 +92,7 @@ def check_web_server_status(api_url): sys.exit(-1) def clean_state_name(state_name): - return state_name.replace('task-', '') + return state_name.lower() # Config def print_config(workers = None): @@ -115,18 +117,14 @@ def print_values(workers = None, api_url = None): data = get_data('tasks', api_url) counters = dict([(key, 0) for key in TASK_STATES]) - for task_name, task_data in data.iteritems(): - for entry in task_data: - if not entry.get('state', None): - continue - - state = entry.get('state', None) - hostname = entry.get('hostname', None) - - if workers and hostname not in workers: - continue - - counters[state] += 1 + for task_name, task_data in data: + state = task_data['state'] + hostname = task_data['worker']['hostname'] + + if workers and hostname not in workers: + continue + + counters[state] += 1 for name in TASK_STATES: name_cleaned = clean_state_name(name) diff --git a/plugins/celery/celery_tasks-2 b/plugins/celery/celery_tasks-2 index 76fab43b..d70e7994 100755 --- a/plugins/celery/celery_tasks-2 +++ b/plugins/celery/celery_tasks-2 @@ -61,11 +61,13 @@ URL_ENDPOINTS = { 'task_details': '/api/task/name/%s', } TASK_STATES = ( - 'task-accepted', - 'task-received', - 'task-succeeded', - 'task-failed', - 'task-retried', + 'PENDING', + 'RECEIVED', + 'STARTED', + 'SUCCESS', + 'FAILURE', + 'REVOKED', + 'RETRY' ) def get_data(what, api_url, *args):