aws / sagemaker-tensorflow-serving-container

A TensorFlow Serving solution for use in SageMaker. This repo is now deprecated.
Apache License 2.0
174 stars 101 forks source link

Adding gunicorn config file. #200

Closed samueleresca closed 2 years ago

samueleresca commented 3 years ago

Description of changes:

This change provides a better way to configure gunicorn in the serving container.

Instead of using ad-hoc env vars (see SAGEMAKER_GUNICORN_WORKERS or SAGEMAKER_GUNICORN_THREADS) we can use the configuration file approach (https://docs.gunicorn.org/en/stable/settings.html#config-file).

In this way, it is possible to specify the configuration of gunicorn along with code of the model:

    model1
        |--[model_version_number]
            |--variables
            |--saved_model.pb
    model2
        |--[model_version_number]
            |--assets
            |--variables
            |--saved_model.pb
    code
        |--lib
            |--external_module
        |--inference.py
        |--gunicorn_config.py

The resulting gunicorn_command should look like something similar to this:

gunicorn -c /opt/ml/model/code/gunicorn_config.py [<additional_arg>,...] python_service:app

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

sagemaker-bot commented 3 years ago

AWS CodeBuild CI Report

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot commented 3 years ago

AWS CodeBuild CI Report

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

sagemaker-bot commented 3 years ago

AWS CodeBuild CI Report

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository