celerycelerybeat

Celery beat stuck on start


After celery launch, I have the following output:

[2022-12-24 17:42:25,851: INFO/MainProcess] Connected to redis://localhost:6379//
[2022-12-24 17:42:25,854: INFO/MainProcess] mingle: searching for neighbors
[2022-12-24 17:42:26,506: INFO/Beat] beat: Starting...
[2022-12-24 17:42:26,862: INFO/MainProcess] mingle: all alone
[2022-12-24 17:42:26,881: INFO/MainProcess] celery@Bulrathi-Mac-mini.local ready.

implying beat is stuck on start (indeed, periodic tasks are not executed).

I'm starting the celery like this:

celery -A app.celery worker -B -l info

My code is

from datetime import timedelta
from celery import Celery
from celery.utils.log import get_task_logger

celery = Celery(
    __name__,
    broker='redis://localhost:6379',
    include=['tasks']
)
celery.conf.timezone = 'UTC'

logger = get_task_logger(__name__)

@celery.task
def periodic_task():
    logger.debug('yay')

CELERYBEAT_SCHEDULE = {
    'every-second': {
        'task': 'periodic_task',
        'schedule': timedelta(seconds=1),
    }
}

I googled for the similar issues, but didn't find any suitable solution. Your help is highly appreciated, thank you in advance.


Solution

  • You can try to execute the celery beat as a separate service and check your configuration:

    celery -A app.celery beat -l debug