Make eland_import_hub_model easier to find on Windows. (#559)

This commit is contained in:
Youhei Sakurai 2023-07-20 17:24:35 +09:00 committed by GitHub
parent 664180d93d
commit 4cf92fd9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 9 deletions

16
eland/cli/__init__.py Normal file
View File

@ -0,0 +1,16 @@
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
@ -209,9 +207,9 @@ def main():
textwrap.dedent(
f"""\
\033[31mFailed to run because module '{e.name}' is not available.\033[0m
This script requires PyTorch extras to run. You can install these by running:
\033[1m{sys.executable} -m pip install 'eland[pytorch]'
\033[0m"""
)
@ -274,15 +272,15 @@ def main():
logger.info(f"Creating model with id '{ptm.model_id}'")
ptm.put_config(config=config)
logger.info(f"Uploading model definition")
logger.info("Uploading model definition")
ptm.put_model(model_path)
logger.info(f"Uploading model vocabulary")
logger.info("Uploading model vocabulary")
ptm.put_vocab(vocab_path)
# Start the deployed model
if args.start:
logger.info(f"Starting model deployment")
logger.info("Starting model deployment")
ptm.start()
logger.info(f"Model successfully imported with id '{ptm.model_id}'")

View File

@ -22,7 +22,7 @@ from pathlib import Path
import nox
BASE_DIR = Path(__file__).parent
SOURCE_FILES = ("setup.py", "noxfile.py", "eland/", "docs/", "utils/", "tests/", "bin/")
SOURCE_FILES = ("setup.py", "noxfile.py", "eland/", "docs/", "utils/", "tests/")
# Whenever type-hints are completed on a file it should
# be added here so that this file will continue to be checked

View File

@ -87,7 +87,9 @@ setup(
"matplotlib>=3.6",
"numpy>=1.2.0,<1.24",
],
scripts=["bin/eland_import_hub_model"],
entry_points={
"console_scripts": "eland_import_hub_model=eland.cli.eland_import_hub_model:main"
},
python_requires=">=3.8",
package_data={"eland": ["py.typed"]},
include_package_data=True,