小编muh*_*nan的帖子

python celery - how to add CELERYBEAT_SCHEDULE task at runtime to a worker?

I have created a celery worker with a single celerybeat schedule task which runs at 5 seconds time interval. How can I add another beat task dynamically to the celery worker without stopping it?

Example

app.conf.update(
   CELERY_TASK_RESULT_EXPIRES=3600,
   CELERY_TIMEZONE = 'UTC',
   CELERYBEAT_SCHEDULE = {
    'long-run-5-secs': {
        'task': 'test_proj.tasks.test',
        'schedule': timedelta(seconds=5),
        'args': (16, )
    }
   }
)
Run Code Online (Sandbox Code Playgroud)

With the above configuration, I am able to run the celery worker with beat mode successfully.

Now I need add the below beat schedule dynamically: …

python scheduler celery celerybeat djcelery

6
推荐指数
1
解决办法
3547
查看次数

标签 统计

celery ×1

celerybeat ×1

djcelery ×1

python ×1

scheduler ×1