Do the same, like here Extract GroupResult from taskset_id in Celery? . But after
tasks.save()
I get this 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) + " is not JSON serializable") EncodeError: <GroupResult: 3up2n4tWLihRe2Mx7P7B8Z [b58ae08c-6837-47c1-bf0c-4fb68d032ab4, a9775214-1e7f-4b8d-a57e-b73d76fbff21, bdd2826f-b811-4c68-8e8f-f23d5cada36f]> is not JSON serializable
This is my code:
group_tasks = group([save_to_cross_site_stock_report.s(batch, unique_id) for batch in grouper(100, rows, None)]) tasks = group_tasks.apply_async(task_id=unique_id) tasks.save()
ini file:
[celery] CELERY_RESULT_BACKEND = mongodb:
I work in a pyramid and use pyramid_celery. I need to go to the task group by id in another controller to check how many tasks are completed.
Why am I getting this error? And how to fix it?