Search code examples
djangocelerydjango-celery

maximum (cap) value for CELERYD_TASK_TIME_LIMIT?


we're doing some crazy fun stuff with django-celery. A couple of our tasks take a while, and we'd like to let them do their thing. I tried setting CELERYD_TASK_TIME_LIMIT to a big value like 86400 (24 hours) and yet my tasks are still reporting TimeLimitExceeded at 5 minutes. I've read over the docs more times than I'd care to remember, but I cannot find anything referencing either a default value for CELERYD_TASK_TIME_LIMIT or a max value.

Two really valuable questions for us:

  1. What is the maximum value for CELERYD_TASK_TIME_LIMIT? (right now it appears to be 5 minutes, or 300)
  2. Why can't I set CELERYD_TASK_TIME_LIMIT to None? (yes, I'm pretty sure I understand the implications of potential zombie workers)

In settings.py

CELERYD_TASK_TIME_LIMIT = 86400 #24 hours
CELERYD_TASK_SOFT_TIME_LIMIT = 86400

Solution

  • To answer your question about default values... the defaults for CELERYD_TASK_TIME_LIMIT and CELERYD_TASK_SOFT_TIME_LIMIT are both None. These values are not documented, and a simple grep of the codebase won't help you out much either. I logged all the values of the app's .conf to find out myself:

    >>> import celery
    >>> app = celery.Celery()
    >>> app.conf