diff --git a/src/sagemaker_inference/environment.py b/src/sagemaker_inference/environment.py index 8983942..727d975 100644 --- a/src/sagemaker_inference/environment.py +++ b/src/sagemaker_inference/environment.py @@ -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 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/""" diff --git a/src/sagemaker_inference/model_server.py b/src/sagemaker_inference/model_server.py index 0694671..75ddcc3 100644 --- a/src/sagemaker_inference/model_server.py +++ b/src/sagemaker_inference/model_server.py @@ -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" diff --git a/test/container/dummy/Dockerfile b/test/container/dummy/Dockerfile index 30b10e2..4fe3b5e 100644 --- a/test/container/dummy/Dockerfile +++ b/test/container/dummy/Dockerfile @@ -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" diff --git a/test/container/mxnet/Dockerfile b/test/container/mxnet/Dockerfile index ab99f1c..2728cd2 100644 --- a/test/container/mxnet/Dockerfile +++ b/test/container/mxnet/Dockerfile @@ -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