I'm using celery
and celery-beat
without Django and I have a task which needs to modify celery-beat
schedule when run.
Now I have the following code (module called celery_tasks
):
# __init__.py
from .celery import app as celery_app
__all__ = ['celery_app']
#celery.py
from celery import Celery
import config
celery_config = config.get_celery_config()
app = Celery(
__name__,
include=[
'celery_tasks.tasks',
],
)
app.conf.update(celery_config)
# tasks.py
from celery_tasks import celery_app
from celery import shared_task
@shared_task
def start_game():
celery_app.conf.beat_schedule = {
'process_round': {
'task': 'celery_tasks.tasks.process_round',
'schedule': 5,
},
}
I start celery
with the following command:
celery worker -A celery_tasks -E -l info --beat
start_game
executes and exists normally, but beat process_round
task never runs.
How can I force-reload beat schedule (restarting all workers doesn't seem as a good idea)?