Skip to content
This repository was archived by the owner on Aug 24, 2024. It is now read-only.
This repository was archived by the owner on Aug 24, 2024. It is now read-only.

CELERYBEAT_SCHEDULE Tasks not picked up by the scheduler #21

Open
@ShipraShalini

Description

@ShipraShalini

I am running a simple test to print hello every 30 sec using celery 4.0.2 in my django app.

@app.task()
def test():
    print("hello")

My celery config is:

CELERY_BROKER_URL = REDIS_CELERY_BROKER_URL
CELERY_RESULT_BACKEND = REDIS_CELERY_RESULT_URL  # 'sqs;//' no support for SQS result backend for now
CELERY_MONGODB_SCHEDULER_DB = MONGO_DB
CELERY_MONGODB_SCHEDULER_COLLECTION = "schedules"
CELERY_MONGODB_SCHEDULER_URL = MONGO_URL
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ENABLE_UTC = True
CELERY_DEFAULT_QUEUE = CELERY_DEV_QUEUE
CELERY_QUEUES = {
    CELERY_DEFAULT_QUEUE: {
        'exchange': CELERY_DEFAULT_QUEUE,
        'binding_key': CELERY_DEFAULT_QUEUE,
    }
}

CELERY_BEAT_SCHEDULE = {
    'test': {
        'task': 'proj.tasks.test',
        'schedule': crontab(minute='*/2')
    }
}

The task is picked up when using the default celery.beat.PersistentScheduler but not when using the celerybeatmongo.schedulers.MongoScheduler

The command I use is:
celery beat -A proj -l debug -S celerybeatmongo.schedulers.MongoScheduler

The log says:

[2016-12-17 06:55:13,748: DEBUG/MainProcess] beat: Ticking with max interval->5.00 seconds
[2016-12-17 06:55:14,486: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2016-12-17 06:55:19,492: DEBUG/MainProcess] beat: Synchronizing schedule...
[2016-12-17 06:55:19,492: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.
[2016-12-17 06:55:24,496: DEBUG/MainProcess] beat: Waking up in 5.00 seconds.

There's no document in the mongoDB.

rs0:PRIMARY> db.schedules.find().count(); 
0 

The mongodb is my main database and the user has read-write permission.

Is there any way to fix it? Am I doing anything wrong??

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions