Django & Celery: How to assign a task to run only once using Celery (similar to the "at" command in Linux)?

I looked at the django-celery tutorial and I think that it will really help me to run background tasks without letting users wait. However, I have a specific requirement in the program, so when a user enters a date, django should be able to schedule and delay execution until a later time. I used to use the at program, but this gives a lot of permissions. But when I read the documentation for Celery, I can only see that Celery supports cron as tasks called @periodic_task . I am sure that it also provides an at mechanism, but I could not find any documentation. Can someone point me to some resources or just tell me how to do this? Thanks.

+6
source share
2 answers

The docs indicate that you can schedule tasks to be completed at specific times using the eta argument .

+9
source

You can specify a countdown or ETA argument for the apply_async () function. By doing so, you can determine the earliest execution time of the task, but not the exact one (it depends on your turn). See here for more details.

+3
source

Source: https://habr.com/ru/post/912071/


All Articles