Skip to content
This repository was archived by the owner on Aug 26, 2020. It is now read-only.

Commit 5f374db

Browse files
authored
set nginx proxy timeout >= gunicorn timeout (#185)
1 parent af64014 commit 5f374db

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
CHANGELOG
33
=========
44

5+
1.1.3
6+
=====
7+
8+
* bug-fix: make sure nginx proxy_read_timeout >= gunicorn worker timeout
9+
510
1.1.2
611
=====
712

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def read(fname):
1414

1515
setup(
1616
name='sagemaker_container_support',
17-
version='1.1.2',
17+
version='1.1.3',
1818
description='Open source library for creating containers to run on Amazon SageMaker.',
1919

2020
packages=[PKG_NAME],

src/container_support/etc/nginx.conf.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ http {
2929
proxy_set_header Host $http_host;
3030
proxy_redirect off;
3131
proxy_pass http://gunicorn;
32+
proxy_read_timeout %NGINX_PROXY_READ_TIMEOUT%;
3233
}
3334

3435
location / {

src/container_support/serving.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,16 @@ def _create_nginx_config(serving_env):
162162
template = cs.utils.read_file(nginx_config_template_file)
163163
pattern = re.compile(r'%(\w+)%')
164164

165+
# make sure nginx proxy timeout >= gunicorn timeout
166+
proxy_read_timeout = 60
167+
if int(serving_env.model_server_timeout) > 60:
168+
proxy_read_timeout = int(serving_env.model_server_timeout)
169+
165170
template_values = {
166-
'NGINX_HTTP_PORT': serving_env.http_port
171+
'NGINX_HTTP_PORT': serving_env.http_port,
172+
'NGINX_PROXY_READ_TIMEOUT': str(proxy_read_timeout)
167173
}
174+
168175
config = pattern.sub(lambda x: template_values[x.group(1)], template)
169176
logger.info('nginx config: \n%s\n', config)
170177
cs.utils.write_file(nginx_config_file, config)

0 commit comments

Comments
 (0)