Skip to content

Commit

Permalink
Make eland_import_hub_model easier to find on Windows. (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurai-youhei committed Jul 20, 2023
1 parent 664180d commit 4cf92fd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
16 changes: 16 additions & 0 deletions eland/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"""
)
Expand Down Expand Up @@ -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}'")
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
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
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
"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,
Expand Down

0 comments on commit 4cf92fd

Please sign in to comment.