CronNudge

Published October 21, 2026

How to Monitor Celery Beat Periodic Tasks

Celery beat publishes a message. A worker runs it. If beat is dead, running twice, or publishing into a queue nobody consumes, the task never finishes, and nothing outside the broker tells you. Flower, the Django admin, and the worker log only help when someone is already looking.

This is the failure modes that show up on real beat deployments, a ping that runs only after the task body succeeds, and the same ping from Celery signals. The short Python snippet without beat is on the Python docs page. Schedule and broker behavior is from the Celery periodic-task, configuration, Redis, and SQS docs, and from django-celery-beat's scheduler.

If the schedule lives inside your app process with APScheduler rather than Celery beat, the scheduler dies with that process, and a raised job is only a log line. That page is monitoring APScheduler jobs.

Beat publishes. A worker executes.

celery beat reads the schedule and sends task messages. It does not run the task body. A healthy beat with zero workers fills the queue and still looks idle in the product.

The default scheduler is celery.beat.PersistentScheduler. It stores last-run times in a local shelve file, celerybeat-schedule, unless you pass --schedule. Celery's periodic-task docs say to run a single scheduler for a schedule. A second process publishes duplicate tasks.

celery worker -B embeds beat in the worker. Two replicas of that command are two schedulers. Run beat as its own process, one replica, including on Kubernetes. A skipped schedule there is the same shape as a Kubernetes CronJob.

django-celery-beat's DatabaseScheduler (django_celery_beat.schedulers:DatabaseScheduler) reads PeriodicTask rows. It does not lock out a second beat either.

beat_max_loop_interval defaults to 0. The file scheduler treats that as 300 seconds. django-celery-beat treats it as 5 seconds, so an admin edit shows up on the next loop. Neither loop alerts when the process is gone.

Beat is dead, or it is running twice

A crashed beat, a deploy that dropped the beat container, or a foreground celery beat whose shell closed all look the same from the outside. The worker keeps consuming whatever is already queued, then waits. No new periodic message is published, so there is no exception to page on.

Two beats both call apply_async. You get two messages per tick, and both runs can succeed. Each finished run pings, so the check stays up. The heartbeat covers silence and failures. One beat process is what stops the double publish. Compare log lines with the schedule if you suspect two publishers.

The worker is down, so the queue grows

Beat can be healthy while the message sits in Redis, RabbitMQ, or SQS. A worker started without that queue, or bound with a different -Q, never sees it. The body never starts, so a ping at the end never runs.

acks_late defaults to false, so the worker acks on receive, before the body finishes. A kill after that ack drops the message. acks_late=True prefers a duplicate run over a lost one. Pair it with the visibility timeout below, or a long task is delivered again while the first copy is still running. expire_seconds on a PeriodicTask becomes the message expiry. A late publish past that window is discarded, and the body does not run.

Failures, retries, and a swallowed exception

An exception fails the task. With autoretry_for or self.retry(), Celery raises Retry and tries again up to max_retries. The task_retry signal fires on those attempts. task_failure fires when the task is done failing, not on each retry. A later attempt that returns normally fires task_success once.

A body that catches the exception, logs it, and returns None is a success to Celery. The next tick is published on time. The log line is the only record. Ping after the work, and re-raise, or call /fail, when the work did not happen.

Timezone, enable_utc, and the database scheduler

Periodic schedules use UTC unless you set timezone. On Django, Celery uses TIME_ZONE unless you set CELERY_TIMEZONE, which becomes timezone after config_from_object(..., namespace="CELERY"). enable_utc has defaulted to true since Celery 3.0. Message timestamps are UTC. The crontab is evaluated in timezone.

enable_utc = False is the old compatibility switch. With it false, Celery uses the machine's local zone instead of the timezone you configured. A container with TZ=UTC and a laptop with TZ=America/New_York then fire the same crontab at different instants. Leave enable_utc true and set the timezone in config.

# settings.py, with config_from_object(..., namespace="CELERY")
CELERY_TIMEZONE = "America/New_York"
CELERY_ENABLE_UTC = True
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"

Celery's crontab uses standard five-field day numbers: Sunday is 0 or 7, Monday is 1. Copy those fields into CronNudge. The check timezone has to be the timezone the crontab is evaluated in. Names (mon-fri) avoid the digit. The cron expression examples use that same form.

The file scheduler resets its shelve when the timezone changes. django-celery-beat does not. Clear last_run_at after a timezone change, or the next fire can be skipped or immediate:

python manage.py shell -c 'from django_celery_beat.models import PeriodicTask; PeriodicTask.objects.update(last_run_at=None)'

Each CrontabSchedule row has its own timezone column, and beat uses that column. A row saved as UTC while TIME_ZONE is America/New_York fires hours off the wall clock you meant. Copy the column onto the check.

enabled = False skips the row with no error. The scheduler reloads when the PeriodicTasks change timestamp moves. save() and the admin update it. QuerySet.update() and raw SQL do not, so beat keeps the old schedule until restart. A ClockedSchedule fires once. Pause the check afterward, or the next period alerts.

visibility_timeout on Redis and SQS

Redis and SQS redeliver a message that is not acknowledged within the visibility timeout. RabbitMQ does not use this setting.

The Redis default is 1 hour (broker_transport_options["visibility_timeout"] is 3600). A task, countdown, or ETA longer than that is delivered again. Celery treats periodic publishing as separate from ETA. Raise the timeout to the longest ETA you use. The duplicate shows up with acks_late on a long body, or with a countdown past the timeout.

Celery's SQS default is 30 minutes, applied when Celery creates the queue. A queue you created in AWS keeps its own timeout. SQS caps it at 12 hours (43200 seconds).

app.conf.broker_transport_options = {"visibility_timeout": 7200}

Two finished runs ping twice and the check stays up. Set the timeout above the longest run. The heartbeat still covers the run that never finishes.

Ping only after the body succeeds

Call https://cronnudge.com/ping/<check-id> after the work returns. GET, POST, and HEAD all count. The response is text/plain ok with Cache-Control: no-store. The ping id is not the badge id. The badge stays off until you opt in.

Catch requests.RequestException. A timeout or a connection error must not fail the task. requests only raises on an HTTP status if you call raise_for_status. Five seconds keeps a dead network from holding the worker. A ping that does not land leaves the check to alert after grace.

import os
import requests
from celery import Celery
from celery.schedules import crontab

app = Celery("billing")
app.conf.broker_url = os.environ["CELERY_BROKER_URL"]
app.conf.timezone = "UTC"
app.conf.enable_utc = True
app.conf.beat_schedule = {
    "nightly-export": {
        "task": "billing.nightly_export",
        "schedule": crontab(minute=17, hour=3),
    },
}

def ping(path=""):
    url = os.environ.get("CRONNUDGE_URL")
    if not url:
        return
    try:
        requests.post(url + path, timeout=5)
    except requests.RequestException:
        return

@app.task(name="billing.nightly_export", acks_late=True)
def nightly_export():
    export_rows()
    ping()

crontab(minute=17, hour=3) is 17 3 * * *. One check per task. A shared URL stays up while any other task still pings.

httpx is the same helper. HTTPError includes connect errors and timeouts.

import httpx

def ping(path=""):
    url = os.environ.get("CRONNUDGE_URL")
    if not url:
        return
    try:
        httpx.post(url + path, timeout=5)
    except httpx.HTTPError:
        return

Optional /start and /fail

/start and /fail are paths on the same ping id. /fail alerts immediately. A beat that never publishes never reaches either URL, so the missing success ping is the backstop: one alert down, one when it recovers. Max runtime is in assertions, runs, and agents.

@app.task(name="billing.nightly_export", acks_late=True)
def nightly_export():
    ping("/start")
    try:
        export_rows()
    except Exception:
        ping("/fail")
        raise
    else:
        ping()

Re-raise. An exception you swallow is a successful task, and /fail is the only signal left. Use this block or the signal handlers, not both, or a success pings twice.

The same pings from signals

task_success and task_failure run on the worker, after the body, not in beat. Filter on sender.name so chord unlocks and other tasks do not ping this check. Retry sends task_retry, not task_failure, so a task that fails and then succeeds pings success once.

from celery.signals import task_failure, task_success

WATCHED = {"billing.nightly_export"}

@task_success.connect
def on_task_success(sender=None, **kwargs):
    if sender is None or sender.name not in WATCHED:
        return
    ping()

@task_failure.connect
def on_task_failure(sender=None, **kwargs):
    if sender is None or sender.name not in WATCHED:
        return
    ping("/fail")

Import the handlers in the worker. Leave ping() out of the task when they are connected, or a success pings twice.

Schedule and grace

Use beat's five fields and timezone. On a database row that is CrontabSchedule.timezone. A timedelta or IntervalSchedule is an interval check. The form lists 5 minutes, 15 minutes, 30 minutes, 1 hour, 6 hours, 1 day, and 1 week. The API accepts any whole number of seconds from the plan minimum through 31 days.

Default grace is 5 minutes. The form offers none, 1 minute, 5 minutes, 15 minutes, and 1 hour. The API accepts 0 seconds through 7 days. The ping is at the end, so grace covers queue time plus runtime. A short daily export fits 15 minutes. A 20 minute body needs the 1 hour option. Every minute needs Pro. Free's shortest interval is 5 minutes.

Free is 10 checks, with email and one Slack or Discord channel. Pro is $12 a month for 100 checks, a 1 minute minimum, signed webhooks, and the API. There is no yearly price.

celery -A project inspect ping with an empty reply means no worker is connected. last_run_at moves when beat publishes, not when the body finishes. A growing queue is a down worker. An old last_run_at is a dead or disabled beat. Two log lines per tick is a second beat.

FAQ

Does Celery alert when beat stops? No. A dead beat publishes nothing. An alert happens only when something outside the cluster expected a ping.

What if two beat processes are running? Both publish, the task runs twice, and each success ping keeps the check up. Run one scheduler.

Why did the message sit in the queue? No matching worker took it, or it was discarded as expired. The body never started, so the success ping never ran.

Which timezone is the crontab in? CELERY_TIMEZONE, or Django's TIME_ZONE when that is unset. Keep enable_utc true. A django-celery-beat row uses its own timezone column. Put that zone on the check.

What does visibility_timeout change? Redis (default 1 hour) and SQS (Celery's default 30 minutes) redeliver an unacknowledged message, so a long run can execute twice. Raise it above the longest task. A predefined SQS queue keeps the timeout set in AWS.

Does a failed ping fail the task? Not with the helper above. The task stays successful, and the check alerts after grace because the ping never arrived.


Beat publishes on time, once. The worker finishes. The ping is how you hear about the ticks where that chain stopped. Create the check, or compare the five fields on the cron tool. Related: how to monitor cron jobs, cron expression examples, Airflow Dag schedules, Rails scheduled jobs, and the Python docs.