python - GroupResult is not JSON serializable in Celery -


do similar here retrieving groupresult taskset_id in celery?. after

tasks.save() 

i error:

traceback (most recent call last):   file "/home/rodions/pma/pma/pma/controllers/report/cross_site_stock.py", line 270, in report_cross_site_stock_refresh     tasks.save()   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/result.py", line 769, in save     return (backend or self.app.backend).save_group(self.id, self)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/base.py", line 325, in save_group     return self._save_group(group_id, result)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/mongodb.py", line 170, in _save_group     'result': binary(self.encode(result)),   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/backends/base.py", line 182, in encode     _, _, payload = dumps(data, serializer=self.serializer)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/kombu-3.0.24-py2.7.egg/kombu/serialization.py", line 164, in dumps     payload = encoder(data)   file "/usr/lib/python2.7/contextlib.py", line 35, in __exit__     self.gen.throw(type, value, traceback)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/kombu-3.0.24-py2.7.egg/kombu/serialization.py", line 59, in _reraise_errors     reraise(wrapper, wrapper(exc), sys.exc_info()[2])   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/kombu-3.0.24-py2.7.egg/kombu/serialization.py", line 55, in _reraise_errors     yield   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/kombu-3.0.24-py2.7.egg/kombu/serialization.py", line 164, in dumps     payload = encoder(data)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py", line 141, in dumps     return implementation.dumps(value)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py", line 87, in dumps     return self._encode(data)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/simplejson-3.6.5-py2.7-linux-x86_64.egg/simplejson/__init__.py", line 370, in dumps     return _default_encoder.encode(obj)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/simplejson-3.6.5-py2.7-linux-x86_64.egg/simplejson/encoder.py", line 269, in encode     chunks = self.iterencode(o, _one_shot=true)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/simplejson-3.6.5-py2.7-linux-x86_64.egg/simplejson/encoder.py", line 348, in iterencode     return _iterencode(o, 0)   file "/home/rodions/pma/env/local/lib/python2.7/site-packages/simplejson-3.6.5-py2.7-linux-x86_64.egg/simplejson/encoder.py", line 246, in default     raise typeerror(repr(o) + " not json serializable") encodeerror: <groupresult: 3up2n4twlihre2mx7p7b8z [b58ae08c-6837-47c1-bf0c-4fb68d032ab4, a9775214-1e7f-4b8d-a57e-b73d76fbff21, bdd2826f-b811-4c68-8e8f-f23d5cada36f]> not json serializable 

this code:

group_tasks = group([save_to_cross_site_stock_report.s(batch, unique_id) batch in grouper(100, rows, none)]) tasks = group_tasks.apply_async(task_id=unique_id) tasks.save() 

ini file:

[celery] celery_result_backend = mongodb://localhost:27017/jobs_result broker_url = mongodb://localhost:27017/jobs celery_accept_content = json celery_result_serializer = json celery_task_serializer = json 

i`m workin in pyramid , using pyramid_celery. need refer group of tasks id in controller check how many tasks completed.

why error? , how fix?


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -