celery + django - how to write task state to database -
i'm running celery django , rabbitmq , want see task states in database table. unfortunately no entries written table djcelery_taskstate , can't figure out why.
my settings:
celery_enable_utc = true broker_url = "amqp://guest:guest@localhost:5672/" celery_result_backend = "database" celerybeat_scheduler = 'djcelery.schedulers.databasescheduler' celery_track_started = true celery_send_events = true celery_imports = ("project_management.tasks", "accounting.tasks", "time_tracking.tasks", ) celery_always_eager = false import djcelery djcelery.setup_loader()
my task:
class testtask(task): def run(self, po_id): self.update_state(state=states.started, meta={'total': 0, 'done': false}) #do something.. self.update_state(state=states.success, meta={'total': 100, 'done': true})
i'm starting task follows in view:
testtask.apply_async(args=[], kwargs={})
i'm starting celery workers follows.
python manage.py celeryd -v 1 -b -s celery -e -l info
console gives me following output:
[2013-05-19 11:10:03,774: info/mainprocess] task accounting.tasks.testtask[5463b2ed-0eba-451d-b828-7a89fcd36348] succeeded in 0.0538640022278s: none
any idea wrong setup?
you need start snapshot camera in order see results in database.
python manage.py celerycam
once have running, able see entries in djcelery
tables.
Comments
Post a Comment