Skip to content

Commit e79301c

Browse files
authored
Merge pull request #67 from awslabs/byo_nginx_log_fixes
Small scikit bring your own fixes
2 parents dbdafe6 + e5d08de commit e79301c

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

advanced_functionality/scikit_bring_your_own/container/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ ENV PYTHONUNBUFFERED=TRUE
3333
ENV PYTHONDONTWRITEBYTECODE=TRUE
3434
ENV PATH="/opt/program:${PATH}"
3535

36-
# Make nginx log to stdout/err so that the log messages will be picked up by the
37-
# Docker logger
38-
RUN ln -s /dev/stdout /tmp/nginx.access.log && ln -s /dev/stderr /tmp/nginx.error.log
39-
4036
# Set up the program in the image
4137
COPY decision_trees /opt/program
4238
WORKDIR /opt/program

advanced_functionality/scikit_bring_your_own/container/decision_trees/nginx.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ daemon off; # Prevent forking
33

44

55
pid /tmp/nginx.pid;
6-
error_log /tmp/nginx.error.log;
6+
error_log /var/log/nginx/error.log;
77

88
events {
99
# defaults
@@ -12,8 +12,8 @@ events {
1212
http {
1313
include /etc/nginx/mime.types;
1414
default_type application/octet-stream;
15-
access_log /tmp/nginx.access.log combined;
16-
15+
access_log /var/log/nginx/access.log combined;
16+
1717
upstream gunicorn {
1818
server unix:/tmp/gunicorn.sock;
1919
}

advanced_functionality/scikit_bring_your_own/container/decision_trees/serve

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ def start_server():
4141
print('Starting the inference server with {} workers.'.format(model_server_workers))
4242

4343

44+
# link the log streams to stdout/err so they will be logged to the container logs
45+
subprocess.check_call(['ln', '-sf', '/dev/stdout', '/var/log/nginx/access.log'])
46+
subprocess.check_call(['ln', '-sf', '/dev/stderr', '/var/log/nginx/error.log'])
47+
4448
nginx = subprocess.Popen(['nginx', '-c', '/opt/program/nginx.conf'])
4549
gunicorn = subprocess.Popen(['gunicorn',
4650
'--timeout', str(model_server_timeout),

advanced_functionality/scikit_bring_your_own/scikit_bring_your_own.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,15 +481,15 @@
481481
"metadata": {},
482482
"outputs": [],
483483
"source": [
484-
"sess.delete_endpoint(predictor.endpoint)"
484+
"# sess.delete_endpoint(predictor.endpoint)"
485485
]
486486
}
487487
],
488488
"metadata": {
489489
"kernelspec": {
490-
"display_name": "Python 3",
490+
"display_name": "Environment (conda_python3)",
491491
"language": "python",
492-
"name": "python3"
492+
"name": "conda_python3"
493493
},
494494
"language_info": {
495495
"codemirror_mode": {

0 commit comments

Comments
 (0)