flower icon indicating copy to clipboard operation
flower copied to clipboard

Task status Displays only the built-in status

Open KKKKKKKEM opened this issue 4 years ago • 1 comments

Describe the bug Task status will not show the status of custom settings,it will only display the built-in status such as STARTED, FAILURE. When my task is running, I will set a custom status for the task, such as Running, Closed. When I use celery to query the status of the task, I can find that the status has been changed. But when I check it on the flower website, I find that the status is still STARTED.

I want to know if this is because of a bug or because of my configuration problem. thanks.

Screenshots image image

KKKKKKKEM avatar Jul 27 '21 02:07 KKKKKKKEM

Hi @KKKKKKKEM ,

  • Flower makes use of the events which are sent by Celery.
  • Celery does not send custom events.

Here Celery describes the events which are sent by the worker by default.

Use send_event to send custom events from Celery.

@app.task(bind=True)
def simple_task(self, *args, **kwargs):
    self.update_state(state="PROCESSING_SIMPLE")
    self.send_event(type_="task-processing-simple")
    sleep(10)
    result = 1 + 1 
    return result

From flower UI screenshot01

From Celery events screenshot02

From flower metrics screenshot03

achuthvarghese avatar Oct 07 '21 11:10 achuthvarghese