0👍
I’m also running something similar with no problem (it’s not executed on startup).
The only difference from your code is that I’m specifying the minutes as well, so it worth trying:
CELERY_BEAT_SCHEDULE = {
"test-task": {
"task": "myapp.tasks.test_task",
"args": (),
"schedule": crontab(minute='0', hour=20), # Should execute at 8pm UTC!
}
}
0👍
I have a similar problem. In my case the difference is that only on Dev env under Ubuntu WSL on Windows celery beat schedules periodic tasks every time the celery beat instance starts-up.
Under production in Debian, this issue never occurs. Maybe this is related either to some debug settings on celery, or to environment settings. Anyway in my case scheduler configuration looks like this:
@app.on_after_finalize.connect
def setup_periodic_tasks(sender, **kwargs):
sender.add_periodic_task(crontab(hour=18, day_of_week=3), celery_remove_old_feature_builds.s(), name='Delete older than last 3 FBs')
sender.add_periodic_task(crontab(minute=30, hour="*/6"),
celery_pull_notanalyzed_and_envissue_testruns_by_all_testset_filters.s(),
name='celery_pull_and_analyze_not_analyzed_test_runs_by_all_regfilters')
sender.add_periodic_task(crontab(minute=0, hour="6", day_of_week=1),
celery_remove_old_passed_logs_from_log_storage.s(),
name='celery_remove_old_passed_logs_from_log_storage')
sender.add_periodic_task(crontab(minute=0, hour="20"),
celery_pull_passed_testruns_by_all_testset_filters.s(),
name='celery_pull_passed_testruns_by_all_testset_filters')
sender.add_periodic_task(crontab(minute=0, hour="21"),
celery_download_latest_passed_logs_to_storage.s(),
name='celery_download_latest_passed_logs_to_storage')
- [Django]-Django/Python convert PDF using shell (os.system/Popen) not working in production
- [Django]-Get method classname inside decorator at __init__ in python
- [Django]-I can't insert a footnote into the copied text
- [Django]-'Cannot alter upload handlers' while trying to upload file
Source:stackexchange.com