Skip to content

Commit

Permalink
Merge pull request #7985 from DIRACGridBot/cherry-pick-2-07c6ead9f-in…
Browse files Browse the repository at this point in the history
…tegration

[sweep:integration] fix: removed elastic in favor of opensearch client
  • Loading branch information
fstagni authored Jan 14, 2025
2 parents 379b7d1 + ddbf918 commit 00b9747
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 34 deletions.
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ dependencies:
- cmreshandler >1.0.0b4
- cwltool
- db12
- elasticsearch <7.14
- elasticsearch-dsl
- opensearch-py
- fts3
- gitpython >=2.1.0
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ server =
# (it just installs into site-packages)
# arc
CMRESHandler
elasticsearch <7.14
elasticsearch_dsl
opensearch-py
GitPython
ldap3
apache-libcloud
Expand Down
43 changes: 13 additions & 30 deletions src/DIRAC/Core/Utilities/ElasticSearchDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,22 @@
from urllib import parse as urlparse

import certifi
from opensearchpy import OpenSearch as Elasticsearch
from opensearchpy.exceptions import (
ConflictError,
NotFoundError,
RequestError,
TransportError,
)
from opensearchpy.exceptions import (
ConnectionError as ElasticConnectionError,
)
from opensearchpy.helpers import BulkIndexError, bulk

try:
from opensearchpy import OpenSearch as Elasticsearch
from opensearchpy.exceptions import (
ConflictError,
NotFoundError,
RequestError,
TransportError,
)
from opensearchpy.exceptions import (
ConnectionError as ElasticConnectionError,
)
from opensearchpy.helpers import BulkIndexError, bulk
from opensearchpy import A, Q, Search
except ImportError:
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import (
ConflictError,
NotFoundError,
RequestError,
TransportError,
)
from elasticsearch.exceptions import (
ConnectionError as ElasticConnectionError,
)
from elasticsearch.helpers import BulkIndexError, bulk

try:
try:
from opensearchpy import A, Q, Search
except ImportError:
from opensearch_dsl import A, Q, Search
except ImportError:
from elasticsearch_dsl import A, Q, Search
from opensearch_dsl import A, Q, Search


from DIRAC import S_ERROR, S_OK, gLogger
Expand Down

0 comments on commit 00b9747

Please sign in to comment.