26π
β
eta/countdown options enable to delay the task execution:
https://docs.celeryq.dev/en/stable/userguide/calling.html#eta-and-countdown
π€mher
2π
I think you are trying to avoid race condition of your own scripts, not asking for a method to delay a task run.
Then you can create a task, and in that task, call each of your task with .apply(), not .apply_async() or .delay(). So that these tasks run sequentially
π€Yefei
- [Django]-Connect with Facebook in Django Rest Framework + Django Social Auth
- [Django]-(urls.W005) URL namespace 'LnkIn' isn't unique.
- [Django]-Why is Django throwing error "DisallowedHost at /"?
1π
To define delay on task execution use apply_async()
with countdown option in the following format:
from datetime import timedelta
#Delay for 10 seconds
T.apply_async(args=[arg1, arg2], countdown = 10)
#Delay for 10 days
T.apply_async(args=[arg1, arg2], countdown = timedelta(days=10))
By using timedelta
it is possible to define more complicated delays for task execution.
Note that delay()
is another calling API but does not support countdown for delay.
π€Pouya Esmaeili
- [Django]-Django β Why should I ever use the render_to_response at all?
- [Django]-How long is token valid? Django REST Framework
- [Django]-IntegrityError: null value in column "id" for all models/fields with ForeignKey after postgres restore from dump
Source:stackexchange.com