torado,celery raise is not JSON serializable
代码就是这里了:
https://github.com/mher/tornado-celery/
报错:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado-4.0.2-py2.7-linux-x86_64.egg/tornado/web.py", line 1288, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
File "/usr/local/lib/python2.7/dist-packages/tornado-4.0.2-py2.7-linux-x86_64.egg/tornado/web.py", line 1475, in wrapper
result = method(self, *args, **kwargs)
File "examples/tornado_async.py", line 14, in get
tasks.sleep.apply_async(args=[3], callback=self.on_result)
File "/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/task.py", line 555, in apply_async
**dict(self._get_exec_options(), **options)
File "/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/base.py", line 353, in send_task
reply_to=reply_to or self.oid, **options
File "/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/amqp.py", line 305, in publish_task
**kwargs
File "/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/messaging.py", line 168, in publish
routing_key, mandatory, immediate, exchange, declare)
File "/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/connection.py", line 436, in _ensured
return fun(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/messaging.py", line 184, in _publish
mandatory=mandatory, immediate=immediate,
File "/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/transport/virtual/__init__.py", line 521, in basic_publish
message, exchange, routing_key, **kwargs
File "/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/transport/virtual/exchange.py", line 61, in deliver
_put(queue, message, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/transport/redis.py", line 673, in _put
client.lpush(self._q_for_pri(queue, pri), dumps(message))
File "/usr/local/lib/python2.7/dist-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py", line 141, in dumps
return implementation.dumps(value)
File "/usr/local/lib/python2.7/dist-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py", line 87, in dumps
return self._encode(data)
File "/usr/lib/python2.7/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 178, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: is not JSON serializable