Dynamic update of the celery_crontab_schedule table? #15
Comments
Yes! Thank you for raising the issue. You can update tasks in the SQL tables to achieve 'dynamic' updates the schedule tasks. There is an example in proejct, you can quickstart as follow: Environment:
First, download the repo and enter
Second, run the
Create console 2 to run celery beat:
After run celery beat, console 2 wil print as follow:
Third, create Console 3 in pipenv shell:
After run
It don't need to restart Is this solved your problem? You can read Thanks. BTW, django-celery-beat maybe help for you though it is for django. |
Your new Python interpreter example worked exactly as I hoped. Thank you. (^_^)// Celery is a complex project. Adapting Celery and your module to the Flask app context will be challenging. Do you have any experiencing implementing your module in a Flask app? |
Thank you for your compliment. I think Flask is flexibly. So what should you do is not important. And now there are no best practices for Flask with celery-sqlalchemy-scheduler. You can use same datebase with flask app, or use a separate database instance for celery-sqlalchemy-scheduler. Maybe flask-celery-example is help for you. |
|
Hello,
I've installed this package. The echo task examples are all running as expected. I added my own toy task that writes a test file to a directory--All good. Great project. Thank you.
Reading your code and examples I wish for one feature not mentioned in documentation. I am searching for a solution to support my Flask project. I need to dynamically change (create, update, delete) the SQL tables in
celery-sqlalchemy-scheduler
without restarting Flask, Celery workers, or Celery Beat.I don't need to add new functions to
tasks.py
. I just need to add new task instances and change schedules.For example,
tasks.add
withargs [1,5]
) in thecelery_periodic_task
table.args
from[1,2]
to[10,2]
in thecelery_periodic_task
table.celery_crontab_schedule
table, and change(0 4 * * *)
to(* */4 * * *)
.Can I update tasks in the SQL tables to achieve 'dynamic' updates with this project?
There is another older package celery_sqlalchemy_scheduler which promised to 'dynamically add tasks at runtime' and this package is based on Celery v3. I was happy to find your project using Celery v4, because I understand v4 has added additional decorators to update Celery Beat at runtime--if I understand this correctly, but I'm still a little new to the guts and gears of Celery. It's all very complex.
Thanks again. Great project.
The text was updated successfully, but these errors were encountered: