Nic*_*son 5 celery django-celery
我安装了芹菜,并与django一起工作。我有一些定期运行的任务。芹菜日志显示任务已执行,并且返回了某些内容。
[2017-03-26 14:34:27,039: INFO/MainProcess] Received task: my_webapp.apps.events.tasks.clean_outdated[87994396-04f7-452b-a964-f6bdd07785e0]
[2017-03-26 14:34:28,328: INFO/PoolWorker-1] Task my_webapp.apps.events.tasks.clean_outdated[87994396-04f7-452b-a964-f6bdd07785e0] succeeded in 0.05246314400005758s: 'Removed 56 event(s)
| Removed 4 SGW(s)
'
Run Code Online (Sandbox Code Playgroud)
但是结果未在django-celery-results管理页面上显示。
这些是我的设置:
CELERY_BROKER_URL = os.environ.get('BROKER_URL')
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Europe/Stockholm'
CELERY_RESULT_BACKEND = 'django-cache'
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
CELERY_RESULT_DB_SHORT_LIVED_SESSIONS = True # Fix for low traffic sites like this one
Run Code Online (Sandbox Code Playgroud)
我也尝试设置CELERY_RESULT_BACKEND = 'django-db'。我知道进行迁移(使用这些设置时),该表存在于数据库中:
my_webapp=> \dt
List of relations
Schema | Name | Type | Owner
--------+--------------------------------------+-------+----------------
...
public | django_celery_beat_crontabschedule | table | my_webapp
public | django_celery_beat_intervalschedule | table | my_webapp
public | django_celery_beat_periodictask | table | my_webapp
public | django_celery_beat_periodictasks | table | my_webapp
public | django_celery_results_taskresult | table | my_webapp
...
(26 rows)
Run Code Online (Sandbox Code Playgroud)
Google不会给我太多帮助,大多数答案是关于djcelery之类的旧图书馆。知道如何获取表中的结果吗?
| 归档时间: |
|
| 查看次数: |
460 次 |
| 最近记录: |