Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot get task result when using elasticsearch as the result backend #31

Open
k0286 opened this issue Jan 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@k0286
Copy link

k0286 commented Jan 4, 2024

Describe the bug
I use Elasticsearch as the result backend and Redis as the broker.

After I enter the page of celery-insights, I click a task for the detail.

The page show the arguments and result loading forever.

The config.py and the log of celery-insights are show in the following

import os

broker_url = "redis://redis:6379"
broker_transport_options = {
    "master_name": "mymaster",
    "db": 0,
    "sentinel_kwargs": {"password": os.getenv("REDIS_SENTINEL_PASSWD", "redis")},
}
result_backend = "elasticsearch://es:9200/celery-result/_doc"
voc_celery_insights_5 | ERROR:    Exception in ASGI application                                                                                                                                                 
voc_celery_insights_5 | Traceback (most recent call last):                                                                                                                                                      
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi                                                                              
voc_celery_insights_5 |     result = await app(  # type: ignore[func-returns-value]                                                                                                                             
voc_celery_insights_5 |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                             
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__                                                                              
voc_celery_insights_5 |     return await self.app(scope, receive, send)                                                                                                                                         
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                         
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__                                                                                         
voc_celery_insights_5 |     await super().__call__(scope, receive, send)                                                                                                                                        
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__                                                                                       
voc_celery_insights_5 |     await self.middleware_stack(scope, receive, send)                                                                                                                                   
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__                                                                                  
voc_celery_insights_5 |     raise exc                                                                                                                                                                           
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__                                                                                  
voc_celery_insights_5 |     await self.app(scope, receive, _send)                                                                                                                                               
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 84, in __call__                                                                                     
voc_celery_insights_5 |     await self.app(scope, receive, send)                                                                                                                                                
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__                                                                               
voc_celery_insights_5 |     raise exc
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
voc_celery_insights_5 |     await self.app(scope, receive, sender)
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
voc_celery_insights_5 |     raise e
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
voc_celery_insights_5 |     await self.app(scope, receive, send)
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
voc_celery_insights_5 |     await route.handle(scope, receive, send)
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
voc_celery_insights_5 |     await self.app(scope, receive, send)                                                                                                                                       [88/4849]
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
voc_celery_insights_5 |     response = await func(request)
voc_celery_insights_5 |                ^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app
voc_celery_insights_5 |     raw_response = await run_endpoint_function(
voc_celery_insights_5 |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
voc_celery_insights_5 |     return await dependant.call(**values)
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi_cache/decorator.py", line 169, in inner
voc_celery_insights_5 |     ret = await ensure_async_func(*args, **kwargs)
voc_celery_insights_5 |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/fastapi_cache/decorator.py", line 99, in ensure_async_func
voc_celery_insights_5 |     return await func(*args, **kwargs)
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/app/tasks/router.py", line 39, in get_task_result
voc_celery_insights_5 |     type=result.name,
voc_celery_insights_5 |          ^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/result.py", line 492, in name
voc_celery_insights_5 |     return self._get_task_meta().get('name')
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/result.py", line 417, in _get_task_meta
voc_celery_insights_5 |     return self._maybe_set_cache(self.backend.get_task_meta(self.id))
voc_celery_insights_5 |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/backends/base.py", line 609, in get_task_meta
voc_celery_insights_5 |     meta = self._get_task_meta_for(task_id)
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/backends/base.py", line 978, in _get_task_meta_for
voc_celery_insights_5 |     meta = self.get(self.get_key_for_task(task_id))
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/backends/elasticsearch.py", line 101, in get                                                                            [57/4849]
voc_celery_insights_5 |     res = self._get(key)
voc_celery_insights_5 |           ^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/backends/elasticsearch.py", line 111, in _get
voc_celery_insights_5 |     return self.server.get(
voc_celery_insights_5 |            ^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/backends/elasticsearch.py", line 247, in server
voc_celery_insights_5 |     self._server = self._get_server()
voc_celery_insights_5 |                    ^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 |   File "/usr/local/lib/python3.11/site-packages/celery/backends/elasticsearch.py", line 235, in _get_server
voc_celery_insights_5 |     return elasticsearch.Elasticsearch(
voc_celery_insights_5 |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
voc_celery_insights_5 | TypeError: Elasticsearch.__init__() got an unexpected keyword argument 'scheme'

Desktop (please complete the following information):

  • Celery: 5.3.6
  • Elasticesarch: 7.17.9
  • Redis: 7.0.11

Additional context

Using flower with same configuration is working normally.

@k0286 k0286 added the bug Something isn't working label Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant