Replies: 1 comment
-
It was my issue , the celery task was returning a set due to a faulty dict comprehension. Not a celery issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a task A which takes in a list of ids as input , checks if the list of ids is a list instance of length greater than 0 , does some operation and then passes that list to another task. I have Kombu version 5.2.4.
The second task however gives out an error like so:
Task_name: atg.tasks.scrape_and_update_products
Task uuid: 2b279bea-ee0f-40f9-9a41-b4a9bec96f9c
Task args: "([5311959], ['meesho.com'])"
Task kwargs: "{}"
Task results: {"exc_type": "EncodeError", "exc_message": ["TypeError('Object of type set is not JSON serializable')"], "exc_module": "kombu.exceptions"}
Traceback: Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/serialization.py", line 39, in _reraise_errors
yield
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/serialization.py", line 210, in dumps
payload = encoder(data)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/utils/json.py", line 68, in dumps
return _dumps(s, cls=cls or _default_encoder,
File "/usr/lib/python3.8/json/init.py", line 234, in dumps
return cls(
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/utils/json.py", line 58, in default
return super().default(o)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type set is not JSON serializable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/celery/app/trace.py", line 518, in trace_task
task.backend.mark_as_done(
File "/home/ubuntu/.local/lib/python3.8/site-packages/celery/backends/base.py", line 162, in mark_as_done
self.store_result(task_id, result, state, request=request)
File "/home/ubuntu/.local/lib/python3.8/site-packages/celery/backends/base.py", line 528, in store_result
self._store_result(task_id, result, state, traceback,
File "/home/ubuntu/.local/lib/python3.8/site-packages/django_celery_results/backends/database.py", line 67, in _store_result
content_type, content_encoding, result = self.encode_content(result)
File "/home/ubuntu/.local/lib/python3.8/site-packages/django_celery_results/backends/database.py", line 144, in encode_content
content_type, content_encoding, content = self._encode(data)
File "/home/ubuntu/.local/lib/python3.8/site-packages/celery/backends/base.py", line 422, in _encode
return dumps(data, serializer=self.serializer)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/serialization.py", line 210, in dumps
payload = encoder(data)
File "/usr/lib/python3.8/contextlib.py", line 131, in exit
self.gen.throw(type, value, traceback)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/serialization.py", line 43, in _reraise_errors
reraise(wrapper, wrapper(exc), sys.exc_info()[2])
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/exceptions.py", line 21, in reraise
raise value.with_traceback(tb)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/serialization.py", line 39, in _reraise_errors
yield
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/serialization.py", line 210, in dumps
payload = encoder(data)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/utils/json.py", line 68, in dumps
return _dumps(s, cls=cls or _default_encoder,
File "/usr/lib/python3.8/json/init.py", line 234, in dumps
return cls(
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/ubuntu/.local/lib/python3.8/site-packages/kombu/utils/json.py", line 58, in default
return super().default(o)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
Beta Was this translation helpful? Give feedback.
All reactions