Answer the question
In order to leave comments, you need to log in
How to organize periodic jobs in a multi-user application?
Hello everyone!)
Please tell me how to implement the ability to create tasks in a multi-user application.
In various tutorials, examples are often given where there is a tasks.py file in which tasks are written. For example:
from celery.task.schedules import crontab
from celery.decorators import periodic_task
@periodic_task(run_every=(crontab(days='*/1')), name="wake_me_up", ignore_result=True)
def wake_me_up(alarm_melody):
run_alarm_clock(alarm_melody)
periodicity = 1
periodic_task(run_every=(crontab(days=f'*/{periodicity}')), name="wake_me_up", ignore_result=True)(wake_me_up)(alarm_melody)
Answer the question
In order to leave comments, you need to log in
Decorators work at the time of import, it is better to store the user schedule in the database:
https://django-celery-beat.readthedocs.io/en/latest/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question