8๐
No, Celery Beat knows nothing about the running tasks.
One way to achieve what you are trying to do is to link the task to itself. async_apply() for an example has optional parameter link
and link_error
which can be used to provide a signature (it can be a single task too) to run if the task finishes successfully (link) or unsuccessfully (link_error).
What I use is the following โ I schedule task to run frequently (say every 5 minutes), and I use a distributed lock to make sure I always have only one instance of the task running.
Finally a reminder โ you can always implement your own scheduler, and use it in your beat configuration. I was thinking about doing this in the past for exactly the same thing you want, but decided that the solution I already have is good enough for me.
- Is django can modify variable value in template?
- Find out what port Django instance is running on?
- Django-rest-framework โ POST Request returns "Method \"GET\" not allowed."
- Run django application without django.contrib.admin
1๐
I use Celery with Django models and I implemented a boolean has_task_running
at the model level. Then with Celery signals I change the state of the flag to True
when signal before_task_publish
is trigged and False
when a task terminates. Not simple but flexible.
- Python import as tuple
- Django-admin.py and virtualenv issue on Windows
- 404 on requests without trailing slash to i18n urls
- Why does JSON returned from the django rest framework have forward slashes in the response?
- Django and multi-stage servers