Skip to content

Commit

Permalink
dockerfile: revert uwsgi due to request timeouts
Browse files Browse the repository at this point in the history
* The job-watcher thread stops working when running with uwsgi since
  all the requests timeout.
  • Loading branch information
Diego Rodriguez committed Jun 25, 2018
1 parent a11f7e3 commit 01f691f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 29 deletions.
15 changes: 2 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

FROM python:3.6

ENV TERM=xterm
RUN apt-get update && \
apt-get install -y vim-tiny && \
pip install --upgrade pip
Expand All @@ -37,17 +38,5 @@ RUN if [ "${DEBUG}" = "true" ]; then pip install -r requirements-dev.txt; pip in
RUN adduser --uid 1000 --disabled-password --gecos '' reanauser && \
chown -R reanauser:reanauser /code
USER reanauser

ARG UWSGI_PROCESSES=2
ENV UWSGI_PROCESSES ${UWSGI_PROCESSES:-2}
ARG UWSGI_THREADS=2
ENV UWSGI_THREADS ${UWSGI_THREADS:-2}
ENV TERM=xterm

EXPOSE 5000

CMD uwsgi --module reana_job_controller.app:app \
--http-socket 0.0.0.0:5000 --master \
--processes ${UWSGI_PROCESSES} \
--threads ${UWSGI_THREADS} \
--stats /tmp/stats.socket
CMD ["python", "reana_job_controller/app.py"]
27 changes: 14 additions & 13 deletions reana_job_controller/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,21 +369,22 @@ def get_openapi_spec():
return jsonify(app.config['OPENAPI_SPEC'])


app.config.from_object('reana_job_controller.config')
if __name__ == '__main__':
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(threadName)s - %(levelname)s: %(message)s'
)

with app.app_context():
app.config['OPENAPI_SPEC'] = build_openapi_spec()
app.config['KUBERNETES_CLIENT'] = create_api_client()
app.config.from_object('config')

job_event_reader_thread = threading.Thread(target=watch_jobs,
args=(JOB_DB,))
with app.app_context():
app.config['OPENAPI_SPEC'] = build_openapi_spec()
app.config['KUBERNETES_CLIENT'] = create_api_client()

job_event_reader_thread.start()
job_event_reader_thread = threading.Thread(target=watch_jobs,
args=(JOB_DB,))

logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(threadName)s - %(levelname)s: %(message)s'
)
job_event_reader_thread.start()

if __name__ == '__main__':
app.run(host='0.0.0.0')
app.run(debug=True, port=5000,
host='0.0.0.0')
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@
'kubernetes>=6.0.0',
'marshmallow>=2.13',
'reana-commons>=0.1.0',
'uwsgi-tools>=1.1.1',
'uWSGI>=2.0.17',
'uwsgitop>=0.10',
]

packages = find_packages()
Expand Down

0 comments on commit 01f691f

Please sign in to comment.