Skip to content

Commit

Permalink
chore: apply feedback from pr
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcalvo committed Jun 12, 2024
1 parent 871407f commit 5654e50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions argilla-server/src/argilla_server/_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ async def ping_search_engine():
async for search_engine in get_search_engine():
if not await search_engine.ping():
raise ConnectionError(
f"Your {settings.humanized_search_engine} endpoint at {settings.obfuscated_elasticsearch()} is not available or not responding.\n"
f"Please make sure your {settings.humanized_search_engine} instance is launched and correctly running and\n"
f"Your {settings.search_engine} endpoint at {settings.obfuscated_elasticsearch()} is not available or not responding.\n"
f"Please make sure your {settings.search_engine} instance is launched and correctly running and\n"
"you have the necessary access permissions. Once you have verified this, restart the argilla server.\n"
)

Expand Down
14 changes: 2 additions & 12 deletions argilla-server/src/argilla_server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import re
import warnings
from pathlib import Path
from typing import List, Literal, Optional, Union
from typing import List, Optional
from urllib.parse import urlparse

from argilla_server.constants import (
Expand Down Expand Up @@ -99,10 +99,7 @@ class Settings(BaseSettings):

es_mapping_total_fields_limit: int = 2000

search_engine: Union[
Literal[SEARCH_ENGINE_ELASTICSEARCH],
Literal[SEARCH_ENGINE_OPENSEARCH],
] = SEARCH_ENGINE_ELASTICSEARCH
search_engine: str = SEARCH_ENGINE_ELASTICSEARCH

vectors_fields_limit: int = Field(
default=5,
Expand Down Expand Up @@ -230,13 +227,6 @@ def search_engine_is_elasticsearch(self) -> bool:
def search_engine_is_opensearch(self) -> bool:
return self.search_engine == SEARCH_ENGINE_OPENSEARCH

Check warning on line 228 in argilla-server/src/argilla_server/settings.py

View check run for this annotation

Codecov / codecov/patch

argilla-server/src/argilla_server/settings.py#L228

Added line #L228 was not covered by tests

@property
def humanized_search_engine(self) -> str:
if self.search_engine_is_elasticsearch:
return "Elasticsearch"
elif self.search_engine_is_opensearch:
return "OpenSearch"

def obfuscated_elasticsearch(self) -> str:
"""Returns configured elasticsearch url obfuscating the provided password, if any"""
parsed = urlparse(self.elasticsearch)
Expand Down

0 comments on commit 5654e50

Please sign in to comment.