-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Open
Description
Checklist
- I have verified that the issue exists against the
masterbranch of Celery.
Steps to reproduce
>>> result = AsyncResult('f95ad3b8-dd58-4eb8-be44-164d16d8d831')
>>> result.get()
Starting new HTTP connection (1): celery-couchdb
http://celery-couchdb "HEAD /celery-results HTTP/1.1" 200 0
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/lib/python3.6/site-packages/celery/result.py", line 224, in get
on_message=on_message,
File "/lib/python3.6/site-packages/celery/backends/base.py", line 470, in wait_for_pending
no_ack=no_ack,
File "/lib/python3.6/site-packages/celery/backends/base.py", line 493, in wait_for
meta = self.get_task_meta(task_id)
File "/lib/python3.6/site-packages/celery/backends/base.py", line 359, in get_task_meta
meta = self._get_task_meta_for(task_id)
File "/lib/python3.6/site-packages/celery/backends/base.py", line 671, in _get_task_meta_for
meta = self.get(self.get_key_for_task(task_id))
File "/lib/python3.6/site-packages/celery/backends/couchdb.py", line 85, in get
return self.connection.get(key)['value']
File "/lib/python3.6/site-packages/pycouchdb/client.py", line 352, in get
(resp, result) = self.resource(*_id_to_path(doc_id)).get(params=params)
File "/lib/python3.6/site-packages/pycouchdb/resource.py", line 51, in __call__
base_url = utils.urljoin(self.base_url, *path)
File "/lib/python3.6/site-packages/pycouchdb/utils.py", line 89, in urljoin
return reduce(_join, path, base)
File "/lib/python3.6/site-packages/pycouchdb/utils.py", line 56, in _join
parts = [head.rstrip(URLSPLITTER), tail.lstrip(URLSPLITTER)]
TypeError: a bytes-like object is required, not 'str'Related to PR #4166 that already fixed 'set'ing task results, but issue remains with getting results.
This fixed it for me (fixed same way as set in #4166)
diff --git a/celery/backends/couchdb.py b/celery/backends/couchdb.py
index 49d26564c..1e8924d4a 100644
--- a/celery/backends/couchdb.py
+++ b/celery/backends/couchdb.py
@@ -82,7 +82,7 @@ class CouchBackend(KeyValueStoreBackend):
def get(self, key):
try:
- return self.connection.get(key)['value']
+ return self.connection.get(bytes_to_str(key))['value']
except pycouchdb.exceptions.NotFound:
return None
antoinerg