jeudi 23 juillet 2015

Specify separate tables for each Celery task

Say I have several Celery tasks like this, dumping their results to an SQLite database every minute:

CELERYBEAT_SCHEDULE = {
'do_task_add': {
    'task': 'tasks.add',
    'schedule': crontab(),
    },

'do_task_multiply': {
    'task': 'tasks.multiply',
    'schedule': crontab(),
    },
}

And this is my database configuration:

BROKER_URL = 'sqla+sqlite:///database.db'
CELERY_RESULT_BACKEND = "db+sqlite:///database.db"
CELERY_RESULT_DBURI = 'db+sqlite:///database.db'

All results get added to the default table celery_taskmeta. Is it possible to define your own tables for each specific task? Having many tasks going on at the same time, it can be hard to distinguish them when they share table.

Aucun commentaire:

Enregistrer un commentaire