vendredi 17 août 2018

Celery: is there good way to check if task with some args already running?

I.e. we have task do_something(something_id) and before place new task i'd like to check is there already running task with particular something_id.

I came up with the method, which involves redis pubsub channel with id like 'do_something{}'.format(something_id) and task supervisor thread, which replays to some hello message to this channel, if the task running. So before place new task I send hello message to this channel, wait for reply and if no - place the task. But all this stuff is complicated and works not so well. Are there any other methods?

Aucun commentaire:

Enregistrer un commentaire