This server was generated by the swagger-codegen project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.
This example uses the Connexion library on top of Flask.
Python 3.7
Docker
To build the microservice image
docker build -t sagemaker-service .
To run the microservice
docker run \
-p 8080:8080 \
-e AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION=<AWS_DEFAULT_REGION> \
--name sagemaker-service \
sagemaker-service
If you want to run the microservice on another port
docker run \
-p <PORT>:8080 \
-e AWS_ACCESS_KEY_ID=<AWS_ACCESS_KEY_ID> \
-e AWS_SECRET_ACCESS_KEY=<AWS_SECRET_ACCESS_KEY> \
-e AWS_DEFAULT_REGION=<AWS_DEFAULT_REGION> \
--name sagemaker-service \
sagemaker-service
To check that you have a running container
docker ps -f name=sagemaker-service
Your predictive service is available at http://localhost:8080/.
Swagger UI documentation is available at http://localhost:8080/ui
Or on the port of choice rescpectively at http://localhost:<PORT>/
and http://localhost:<PORT>/ui
To stop the container
docker stop sagemaker-service
pip3 install -r requirements.txt
python3 -m swagger_server
To launch unit tests, use tox:
pip3 install tox
tox
To launch tests on your SageMaker instance:
First, make sure you have a working and configured environment to use AWS SDK (Option 3, 4 or 5 as described in AWS SDK documentation)
Then, run tests using tox:
pip3 install tox
tox swagger_server/test