Skip to content
Snippets Groups Projects
Unverified Commit db96e9e6 authored by Daniel Ecer's avatar Daniel Ecer Committed by GitHub
Browse files

added start-autocut.sh script (#115)

parent 35b1470a
No related branches found
No related tags found
No related merge requests found
...@@ -22,3 +22,6 @@ RUN if [ "${install_dev}" = "y" ]; then pip install -r requirements.dev.txt; fi ...@@ -22,3 +22,6 @@ RUN if [ "${install_dev}" = "y" ]; then pip install -r requirements.dev.txt; fi
COPY sciencebeam_gym ${PROJECT_FOLDER}/sciencebeam_gym COPY sciencebeam_gym ${PROJECT_FOLDER}/sciencebeam_gym
COPY *.conf *.sh *.in *.txt *.py ${PROJECT_FOLDER}/ COPY *.conf *.sh *.in *.txt *.py ${PROJECT_FOLDER}/
COPY scripts ${PROJECT_FOLDER}/scripts
ENV PATH ${PROJECT_FOLDER}/scripts:$PATH
...@@ -41,16 +41,24 @@ pytest-not-slow: build-dev ...@@ -41,16 +41,24 @@ pytest-not-slow: build-dev
$(DOCKER_COMPOSE) run --rm sciencebeam-gym-dev pytest -m 'not slow' $(PYTEST_ARGS) $(DOCKER_COMPOSE) run --rm sciencebeam-gym-dev pytest -m 'not slow' $(PYTEST_ARGS)
autocut-start: build .require-AUTOCUT_MODEL_PATH:
@if [ -z "$(AUTOCUT_MODEL_PATH)" ]; then \
echo "AUTOCUT_MODEL_PATH required"; \
exit 1; \
fi
shell-dev:
$(DOCKER_COMPOSE) run --rm sciencebeam-gym bash
autocut-start: .require-AUTOCUT_MODEL_PATH build
$(DOCKER_COMPOSE) run --rm \ $(DOCKER_COMPOSE) run --rm \
-v "$(AUTOCUT_MODEL_PATH):/tmp/model.pkl" \ -v "$(AUTOCUT_MODEL_PATH):/tmp/model.pkl" \
-e "AUTOCUT_MODEL_PATH=/tmp/model.pkl" \ -e "AUTOCUT_MODEL_PATH=/tmp/model.pkl" \
-p 8080:8080 \ -p 8080:8080 \
sciencebeam-gym \ sciencebeam-gym \
gunicorn \ start-autocut.sh
'sciencebeam_gym.models.text.crf.autocut_app:create_app()' \
--timeout 10 --log-level debug --workers 1 --worker-class gevent \
--bind 0.0.0.0:8080
ci-build-and-test: ci-build-and-test:
......
#!/bin/bash
set -e
GUNICORN_TIMEOUT=${GUNICORN_TIMEOUT:-10}
GUNICORN_LOG_LEVEL=${GUNICORN_LOG_LEVEL:-info}
GUNICORN_WORKERS=${GUNICORN_WORKERS:-1}
GUNICORN_WORKER_CLASS=${GUNICORN_WORKER_CLASS:-gevent}
GUNICORN_HOST=${GUNICORN_HOST:-0.0.0.0}
GUNICORN_PORT=${GUNICORN_PORT:-8080}
if [ -z "${APP_NAME}" ]; then
echo "APP_NAME required"
exit 1
fi
APP_FACTORY_SUFFIX=':create_app()'
CMD="gunicorn \
"${APP_NAME}${APP_FACTORY_SUFFIX}" \
--timeout "${GUNICORN_TIMEOUT}" \
--log-level "${GUNICORN_LOG_LEVEL}" \
--workers "${GUNICORN_WORKERS}" \
--worker-class "${GUNICORN_WORKER_CLASS}" \
--bind "${GUNICORN_HOST}:${GUNICORN_PORT}" \
$@"
echo $CMD
exec $CMD
#!/bin/bash
set -e
export APP_NAME=sciencebeam_gym.models.text.crf.autocut_app
exec "$(dirname $0)/start-app.sh" $@
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment