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

Make model upload compatible with serverless clusters #698

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions eland/cli/eland_import_hub_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from elastic_transport.client_utils import DEFAULT
from elasticsearch import AuthenticationException, Elasticsearch

from eland._version import __version__
from eland.common import parse_es_version

MODEL_HUB_URL = "https://huggingface.co"
Expand Down Expand Up @@ -195,6 +196,17 @@ def get_es_client(cli_args, logger):

def check_cluster_version(es_client, logger):
es_info = es_client.info()

if (
"build_flavor" in es_info["version"]
and es_info["version"]["build_flavor"] == "serverless"
):
Comment on lines +200 to +203
Copy link
Member

Choose a reason for hiding this comment

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

It's OK to assume build_flavor is set, it was here in the 7.x days too: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/targz.html#_checking_that_elasticsearch_is_running

Suggested change
if (
"build_flavor" in es_info["version"]
and es_info["version"]["build_flavor"] == "serverless"
):
if es_info["version"]["build_flavor"] == "serverless":

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh it failed running against a locally built and run Elasticsearch maybe it's not in dev builds. I'd prefer to keep this to be safe

logger.info(f"Connected to serverless cluster '{es_info['cluster_name']}'")
# Serverless is compatible
# Return the latest known semantic version, i.e. this version
return parse_es_version(__version__)

# check the semantic version for none serverless clusters
logger.info(
f"Connected to cluster named '{es_info['cluster_name']}' (version: {es_info['version']['number']})"
)
Expand Down