django-celery-beat icon indicating copy to clipboard operation
django-celery-beat copied to clipboard

Periodic task crontab shedule not working

Open Elendiar opened this issue 3 years ago • 1 comments

Summary:

Include a brief descrioption of the problem here, and fill out the version info below.

  • Celery Version: Django 3.2.11
  • Celery-Beat Version: 2.2.1

Exact steps to reproduce the issue:

common.py

IMPORT_EXPORT_CELERY_INIT_MODULE = "proj.celery"

CELERY_BROKER_URL = environ.get("CELERY_BROKER")
CELERY_RESULT_BACKEND = "django-db"
CELERY_CACHE_BACKEND = "django-cache"
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
CELERY_TIMEZONE = environ.get("TZ")
CELERY_ENABLE_UTC = False

init.py

from .celery import app as celery_app

__all__ = ('celery_app', )

celery.py

import os
from celery import Celery

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.production')

app = Celery('config')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()


@app.task(bind=True)
def debug_task(self):
    print(f'Request: {self.request!r}')

tasks.py

from celery import shared_task


@shared_task
def test():
    print('===========TEST CELERY TASK===========')
    return


@shared_task
def test2():
    print('===========TEST CELERY TASK 2===========')
    return

celery.sh

#!/usr/bin/env bash

exec celery --app config worker -B --loglevel=debug --concurrency=1 &
exec celery -A config beat --loglevel=debug --scheduler django_celery_beat.schedulers:DatabaseScheduler

Detailed information

Nothing happens. Interval works fine, but any crontab shedule wont execute. In log nothing happens too. I search same issues since 2018 with celery beat and crontab, change tz and other but nothing help.

Elendiar avatar Jan 24 '22 16:01 Elendiar

I have the same problem. Did you find a solution @Elendiar ?

eikebartels avatar Nov 30 '23 07:11 eikebartels