Skip to content

result backend not save properly in elastic search #6306

@imadmoussa1

Description

@imadmoussa1

Checklist

  • I have verified that the issue exists against the master branch of Celery.
  • This has already been asked to the discussion group first.
  • I have read the relevant section in the
    contribution guide
    on reporting bugs.
  • I have checked the issues list
    for similar or identical bug reports.
  • I have checked the pull requests list
    for existing proposed fixes.
  • I have checked the commit log
    to find out if the bug was already fixed in the master branch.
  • I have included all related issues and possible duplicate issues
    in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

  • I have included the output of celery -A proj report in the issue.
    (if you are not able to do this, then at least specify the Celery
    version affected).
  • I have verified that the issue exists against the master branch of Celery.
  • I have included the contents of pip freeze in the issue.
  • I have included all the versions of all the external dependencies required
    to reproduce this bug.

Optional Debugging Information

  • I have tried reproducing the issue on more than one Python version
    and/or implementation.
  • I have tried reproducing the issue on more than one message broker and/or
    result backend.
  • I have tried reproducing the issue on more than one version of the message
    broker and/or result backend.
  • I have tried reproducing the issue on more than one operating system.
  • I have tried reproducing the issue on more than one workers pool.
  • I have tried reproducing the issue with autoscaling, retries,
    ETA/Countdown & rate limits disabled.
  • I have tried reproducing the issue after downgrading
    and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

Possible Duplicates

Environment & Settings

Celery version:
4.4.7

celery report Output:

types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).
  warnings.warn(message, category=ElasticsearchDeprecationWarning)
[2020-08-18 09:14:06,421: ERROR/MainProcess] Pool callback raised exception: RequestError(400, 'illegal_argument_exception', {'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}], 'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}, 'status': 400})
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/billiard/pool.py", line 1796, in safe_apply_callback
    fun(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/worker/request.py", line 528, in on_failure
    store_result=self.store_errors,
  File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 160, in mark_as_failure
    traceback=traceback, request=request)
  File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 407, in store_result
    request=request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 758, in _store_result
    self.set(self.get_key_for_task(task_id), self.encode(meta))
  File "/usr/local/lib/python3.7/site-packages/celery/backends/elasticsearch.py", line 109, in set
    datetime.utcnow().isoformat()[:-3]
  File "/usr/local/lib/python3.7/site-packages/celery/backends/elasticsearch.py", line 126, in _index
    **kwargs
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 139, in _wrapped
    return func(*args, params=params, headers=headers, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/__init__.py", line 380, in index
    body=body,
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 352, in perform_request
    timeout=timeout,
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 256, in perform_request
    self._raise_error(response.status, raw_data)
  File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 288, in _raise_error
    status_code, error_message, additional_info
elasticsearch.exceptions.RequestError: RequestError(400, 'illegal_argument_exception', 'mapper [result.args] of different type, current_type [long], merged_type [text]')

Steps to Reproduce

Required Dependencies

  • Minimal Python Version: 3.7
  • Minimal Celery Version: 4.4.0
  • Minimal OS and/or Kernel Version: ubuntu

Python Packages

pip freeze Output:

uvicorn==0.11.3
fastapi>=0.61.0
fastapi_permissions==0.2.6
python_multipart==0.0.5
email_validator==1.0.5
requests==2.23.0
celery==4.4.7

Other Dependencies

Details

N/A

Minimally Reproducible Test Case

Details

Expected Behavior

Expected to Save the result backend as Object to elastic search, So I will be able to use it in the dashboard.

Actual Behavior

The result object is saved as text, and after trying all the solutions found after the search, I still have errors and not able to the result backend to elastic search.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions