aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorzsloan2018-01-31 15:11:44 -0600
committerGitHub2018-01-31 15:11:44 -0600
commit4ae2d548127eeeaa7cec0baf1b788005b5e8e51d (patch)
treee3e7b8098f092d74e2d7aa21dc848abff9484c56 /bin
parent1a00b3976f770865f47d4526db92131704b55797 (diff)
parent8e79b13e9126a1a978aff64cabfd374760e0b5cc (diff)
downloadgenenetwork2-4ae2d548127eeeaa7cec0baf1b788005b5e8e51d.tar.gz
Merge pull request #275 from pjotrp/pjotr
Added cli swith and set timeout to 3 minutes for gunicorn-dev mode
Diffstat (limited to 'bin')
-rwxr-xr-xbin/genenetwork222
1 files changed, 19 insertions, 3 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index cbaba76f..f64576d5 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -1,8 +1,11 @@
#! /bin/bash
#
+# This is the startup script for GN2. It sets the environment variables to pick
+# up a Guix profile and allows for overriding parameters.
+#
# Typical usage
#
-# env GN2_PROFILE=~/opt/genenetwork2-phewas ./bin/genenetwork2
+# env GN2_PROFILE=~/opt/genenetwork2-phewas ./bin/genenetwork2 ~/my_settings.py
#
# Where GN2_PROFILE points to the GNU Guix profile used for deployment.
#
@@ -41,6 +44,7 @@
# env GN2_PROFILE=~/opt/gn-latest-guix ./bin/genenetwork2 ./etc/default_settings.py -gunicorn "--bind 0.0.0.0:5003 --workers=1 wsgi"
SCRIPT=$(realpath "$0")
+echo SCRIPT=$SCRIPT
GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
GN2_ID=$(cat /etc/hostname):$(basename $GN2_BASE_DIR)
@@ -96,6 +100,8 @@ if [ -z $GN2_PROFILE ] ; then
if [ -d $GN2_PROFILE ]; then
echo "Best guess is $GN2_PROFILE"
fi
+ echo "ERROR: always set GN2_PROFILE"
+ exit 1
fi
if [ -z $GN2_PROFILE ]; then
read -p "PRESS [ENTER] TO CONTINUE..."
@@ -143,7 +149,7 @@ set|grep guix
set|grep $GN2_PROFILE
set|grep TMPDIR
-# Now handle command parameter -c
+# Now handle command parameter -c which runs python
if [ "$1" = '-c' ] ; then
cd $GN2_BASE_DIR/wqflask
cmd=${2#wqflask/}
@@ -152,6 +158,16 @@ if [ "$1" = '-c' ] ; then
python $cmd
exit $?
fi
+# Now handle command parameter -cli which runs in bash
+if [ "$1" = "-cli" ] ; then
+ echo "HERE"
+ cd $GN2_BASE_DIR/wqflask
+ cmd=$2
+ echo PYTHONPATH=$PYTHONPATH
+ echo RUNNING COMMAND $cmd
+ $cmd
+ exit $?
+fi
if [ "$1" = '-gunicorn' ] ; then
cd $GN2_BASE_DIR/wqflask
cmd=$2
@@ -164,7 +180,7 @@ if [ "$1" = '-gunicorn-dev' ] ; then
cd $GN2_BASE_DIR/wqflask
echo PYTHONPATH=$PYTHONPATH
if [ -z $SERVER_PORT ]; then echo "ERROR: Provide a SERVER_PORT" ; exit 1 ; fi
- cmd="--bind 0.0.0.0:$SERVER_PORT --workers=1 --reload wsgi"
+ cmd="--bind 0.0.0.0:$SERVER_PORT --workers=1 --timeout 180 --reload wsgi"
echo RUNNING gunicorn $cmd
gunicorn $cmd
exit $?