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

fix: write the mms config file to a subdir of base_dir instead of /etc #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/sagemaker_inference/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
model_dir = os.path.join(base_dir, "model") # type: str
# str: the directory where models should be saved, e.g., /opt/ml/model/

config_dir = os.path.join(base_dir, "etc") # type: str
Copy link
Author

Choose a reason for hiding this comment

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

Naming this directory etc makes sense to me because the source code of sagemaker-inference-toolkit also has a etc directory containing similar config files.

code_dir = os.path.join(model_dir, "code") # type: str
"""str: the path of the user's code directory, e.g., /opt/ml/model/code/"""

Expand Down
4 changes: 2 additions & 2 deletions src/sagemaker_inference/model_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

import sagemaker_inference
from sagemaker_inference import default_handler_service, environment, logging, utils
from sagemaker_inference.environment import code_dir
from sagemaker_inference.environment import code_dir, config_dir

logger = logging.get_logger()

MMS_CONFIG_FILE = os.path.join("/etc", "sagemaker-mms.properties")
MMS_CONFIG_FILE = os.path.join(config_dir, "sagemaker-mms.properties")
DEFAULT_HANDLER_SERVICE = default_handler_service.__name__
DEFAULT_MMS_CONFIG_FILE = pkg_resources.resource_filename(
sagemaker_inference.__name__, "/etc/default-mms.properties"
Expand Down
3 changes: 2 additions & 1 deletion test/container/dummy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ RUN mkdir resnet_18 \

COPY dummy/mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py

RUN mkdir -p /home/model-server/
RUN mkdir -p /home/model-server/ \
&& mkdir -p /opt/ml/etc
COPY dummy/mme_handler_service.py /home/model-server/mme_handler_service.py
ENV SAGEMAKER_HANDLER="/home/model-server/mme_handler_service.py:handle"

Expand Down
4 changes: 3 additions & 1 deletion test/container/mxnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ WORKDIR /

RUN useradd -m model-server \
&& mkdir -p /home/model-server/tmp \
&& chown -R model-server /home/model-server
&& chown -R model-server /home/model-server \
&& mkdir -p /opt/ml/etc \
&& chown -R model-server /opt/ml/etc

COPY mxnet/mms_entrypoint.py /usr/local/bin/dockerd_entrypoint.py
COPY mxnet/config.properties /home/model-server
Expand Down