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

Basic ElasticSearch / ElasticClient 8.x Support #8519

Merged
merged 11 commits into from Oct 4, 2023
Merged

Conversation

flipfloptech
Copy link
Contributor

Description

Adds necessary changes to make elasticsearch 8.x backend's work along with elasticsearch python client 8.x

  1. doc_type is excluded from calls if not specified in the URI
  2. scheme is no longer a parameter but a part of the URI with the client.

Keep in mind you want to use an 8.x client library to connect to an 8.x server

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also you need to relax the version support here https://github.com/celery/celery/blob/main/requirements/extras/elasticsearch.txt and possibly adjust some test.

scheme=self.scheme,
http_auth=http_auth,
)
if elasticsearch.VERSION[0] <= 7:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

less or equal 7 or 8?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do some digging on the client side to see what specific version they removed the scheme parameter from. But I know the 8.9 client version I installed did not have it where the 7.17 client did. So I assumed that 7.x and below would require the scheme parameter. I'll also check if I supply it as part of the URI with the 7.x client if I can skip the scheme entirely and not have that if check at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can try keep support of both 7.x and 8.x for better upgrade ability

@auvipy auvipy added this to the 5.3.x milestone Sep 20, 2023
removed if check for clientside version 7.x or below as specifying the scheme in the URI works like it does with the 8.x client.
Support up to 8.9 python client. 

elasticsearch 7.x client does not work with elasticsearch 8.x server and vice versa.
requirements/extras/elasticsearch.txt Outdated Show resolved Hide resolved
@auvipy
Copy link
Member

auvipy commented Sep 21, 2023

we might need to pull 99b000d from main branch

@auvipy
Copy link
Member

auvipy commented Sep 21, 2023

The following tests are also failing so adjusting or fixing them will be needed

=========================== short test summary info ============================
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_get
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_get_none
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_delete
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_index_conflict
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_index_conflict_without_state
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_index_conflict_with_ready_state_on_backend_without_state
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_index_conflict_with_existing_success
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_index_conflict_with_existing_ready_state
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_backend_concurrent_update
FAILED t/unit/backends/test_elasticsearch.py::test_ElasticsearchBackend::test_backend_index_conflicting_document_removed
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 10 failures !!!!!!!!!!!!!!!!!!!!!!!!!!
============ 10 failed, 875 passed, 1 skipped, 2 warnings in 38.44s ============

@flipfloptech
Copy link
Contributor Author

flipfloptech commented Sep 21, 2023 via email

@auvipy
Copy link
Member

auvipy commented Sep 21, 2023

Yes I was also trying to see if the tests were passing by lowering the version a bit. We can first try to make 8.0.x work then we can go for 8.9 step by step. But im open to your approach as well

@flipfloptech
Copy link
Contributor Author

flipfloptech commented Sep 21, 2023 via email

requirements/extras/elasticsearch.txt Outdated Show resolved Hide resolved
@auvipy
Copy link
Member

auvipy commented Sep 22, 2023

sadly all the unit tests are failing so we need to update/adjust the tests as well related to the result back end

@flipfloptech
Copy link
Contributor Author

flipfloptech commented Sep 22, 2023 via email

@flipfloptech
Copy link
Contributor Author

I fixed the tests, please take a look and see if it's to everyone/your satisfaction.

Also let me know if we need to pull this in:

we might need to pull 99b000d from main branch

@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (bbe8775) 87.45% compared to head (1c1a012) 87.46%.
Report is 10 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8519   +/-   ##
=======================================
  Coverage   87.45%   87.46%           
=======================================
  Files         148      148           
  Lines       18499    18511   +12     
  Branches     3158     3163    +5     
=======================================
+ Hits        16179    16191   +12     
  Misses       2032     2032           
  Partials      288      288           
Flag Coverage Δ
unittests 87.43% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
celery/backends/elasticsearch.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@auvipy auvipy self-requested a review September 29, 2023 08:19
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to increase the code coverage a little bit more? great work so far

requirements/extras/elasticsearch.txt Outdated Show resolved Hide resolved
@Nusnus
Copy link
Member

Nusnus commented Sep 29, 2023

I fixed the tests, please take a look and see if it's to everyone/your satisfaction.

Also let me know if we need to pull this in:

we might need to pull 99b000d from main branch

It's better to rebase on main generally but the lint issues are not related to this commit, they are real according to the log in the CI.

You can run tox -e lint to identify the errors.

requirements/extras/elasticsearch.txt Outdated Show resolved Hide resolved
requirements/extras/elasticsearch.txt Outdated Show resolved Hide resolved
@auvipy
Copy link
Member

auvipy commented Oct 1, 2023

I think see should check if the test coverage can be improve for the PR. others looks okish

@auvipy auvipy merged commit 14892ab into celery:main Oct 4, 2023
29 of 31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants