0

Here is excerpt from my settings.py

CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
import djcelery
from celery.schedules import crontab
djcelery.setup_loader()
CELERY_IMPORTS = ("app.some.tasks",)

CELERYBEAT_SCHEDULE = {
    "send_mail": {
        "task": "app.some.tasks.send_mail",
        "schedule": timedelta(seconds=30),
    },
}

When send_mail task runs, other tasks can not be run (ignored, not delivered as seen from celeryd log)

[2015-08-01 23:39:36,155: INFO/MainProcess] start send_mails task.
[2015-08-01 23:39:36,185: INFO/MainProcess] finish send_mails task.
[2015-08-01 23:40:04,643: INFO/MainProcess] start send_mails task.
[2015-08-01 23:40:04,666: INFO/MainProcess] finish send_mails task.
[2015-08-01 23:40:06,163: INFO/MainProcess] start send_mails task.
[2015-08-01 23:40:06,205: INFO/MainProcess] finish send_mails task.
[2015-08-01 23:40:34,657: INFO/MainProcess] start send_mails task.
[2015-08-01 23:40:34,684: INFO/MainProcess] finish send_mails task.

But if I execute another task during this 30 seconds interval, then it actually runs.

send_mail task

@task
def send_mail():
    log.info( u'start send_mails task.' )
    from django.core import management
    management.call_command('send_mail')
    log.info( u'finish send_mails task.' )

send_mail is command from mailer package.

Celeryd is executed as follows

celeryd --settings=settings --beat --concurrency=8
changer
  • 329
  • 2
  • 4
  • 19
  • Can you show us the code you're using when you're running "Another task"? Based on what you've shown, there's no reason that wouldn't work. – Jack Shedd Aug 01 '15 at 23:41
  • Another task can be as simple as `import time; time.sleep(10); log.info('Done')` The problem is that it is not reproducible locally, only in production. – changer Aug 02 '15 at 07:04

0 Answers0