测试环境是windows 7 64
python 2.7.8
Celery 3.2
Redis 2.8.19
代码就是 Celery 的例子
https://gist.github.com/GameXG/21763336458d417a60ad
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
》 sys.path.append(r".\TaskQueue")
》 from tasks import add
》 r = add.delay(5,10)
》 r.status
'PENDING'
》 r.status
'PENDING'
》 r.ready()
False
状态总是 PENDING ,tasks worker 明明显示任务已经完成了。但总是得不到任务结果,文档上面的几种办法都尝试过了,还是无效...
也尝试过用两个 redis 分开试,结果一样无任务结果...
redis-cli 得到的数据库内容:
127.0.0.1:6379> keys *
1) "_kombu.binding.celeryev"
2) "_kombu.binding.celery"
3) "_kombu.binding.celery.pidbox"
tasks worker工作日志
c:\Python27\Scripts\celery.exe -A tasks worker --loglevel=info
-------------- celery@GameXG-PC v3.1.17 (Cipater)
---- **** -----
--- * *** * -- Windows-7-6.1.7601-SP1
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: tasks:0x2ff2550
- ** ---------- .> transport: redis://localhost:6379//
- ** ---------- .> results: redis://localhost/
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ----
--- ***** ----- [queues]
-------------- .> celery exchange=celery(direct) key=celery
[tasks]
. tasks.add
[2015-03-17 20:53:36,552: INFO/MainProcess] Connected to redis://localhost:6379//
[2015-03-17 20:53:36,605: INFO/MainProcess] mingle: searching for neighbors
[2015-03-17 20:53:37,625: INFO/MainProcess] mingle: all alone
[2015-03-17 20:53:37,638: WARNING/MainProcess] celery@GameXG-PC ready.
[2015-03-17 20:53:46,365: INFO/MainProcess] Received task: tasks.add[9aaa35f7-f1f1-4360-add4-37467aa2d770]
[2015-03-17 20:53:46,377: INFO/MainProcess] Task tasks.add[9aaa35f7-f1f1-4360-add4-37467aa2d770] succeeded in 0.00999999046326s: 15
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.