aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/genenetwork230
-rwxr-xr-xbin/mechnical-rob111
-rwxr-xr-xbin/test-website114
3 files changed, 135 insertions, 120 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index 145ce395..2a83a1cd 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -45,6 +45,7 @@
SCRIPT=$(realpath "$0")
echo SCRIPT=$SCRIPT
+echo GN2_PROFILE=$GN2_PROFILE
GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
GN2_ID=$(cat /etc/hostname):$(basename $GN2_BASE_DIR)
@@ -94,11 +95,13 @@ export WQFLASK_OVERRIDES=$overrides # JSON
echo WQFLASK_SETTINGS=$settings
echo WQFLASK_OVERRIDES=$overrides
-if [ -z $ELASTICSEARCH_PROFILE ]; then
- echo -e "\033[1;33mWARNING: Elastic Search profile has not been set - use ELASTICSEARCH_PROFILE\033[0m";
-else
- PYTHONPATH="$PYTHONPATH${PYTHONPATH:+:}$ELASTICSEARCH_PROFILE/lib/python2.7/site-packages"
-fi
+# This is a temporary hack to inject ES - should have added python2-elasticsearch package to guix instead
+# if [ -z $ELASTICSEARCH_PROFILE ]; then
+# echo -e "WARNING: Elastic Search profile has not been set - use ELASTICSEARCH_PROFILE";
+# else
+# PYTHONPATH="$PYTHONPATH${PYTHONPATH:+:}$ELASTICSEARCH_PROFILE/lib/python2.7/site-packages"
+# fi
+
if [ -z $GN2_PROFILE ] ; then
echo "WARNING: GN2_PROFILE has not been set - you need the environment, so I hope you know what you are doing!"
export GN2_PROFILE=$(dirname $(dirname $(which genenetwork2)))
@@ -125,7 +128,9 @@ else
export PLINK_COMMAND="$GN2_PROFILE/bin/plink2"
export PYLMM_COMMAND="$GN2_PROFILE/bin/pylmm_redis"
export GEMMA_COMMAND="$GN2_PROFILE/bin/gemma"
- export GEMMA_WRAPPER_COMMAND="$GN2_PROFILE/bin/gemma-wrapper"
+ if [ -z $GEMMA_WRAPPER_COMMAND ]; then
+ export GEMMA_WRAPPER_COMMAND="$GN2_PROFILE/bin/gemma-wrapper"
+ fi
while IFS=":" read -ra PPATH; do
for PPart in "${PPATH[@]}"; do
if [ ! -d $PPart ] ; then echo "PYTHONPATH not valid "$PYTHONPATH ; exit 1 ; fi
@@ -163,8 +168,9 @@ if [ "$1" = '-c' ] ; then
cd $GN2_BASE_DIR/wqflask
cmd=${2#wqflask/}
echo PYTHONPATH=$PYTHONPATH
- echo RUNNING COMMAND $cmd
- python $cmd
+ shift ; shift
+ echo RUNNING COMMAND $cmd $*
+ python $cmd $*
exit $?
fi
# Now handle command parameter -cli which runs in bash
@@ -173,8 +179,9 @@ if [ "$1" = "-cli" ] ; then
cd $GN2_BASE_DIR/wqflask
cmd=$2
echo PYTHONPATH=$PYTHONPATH
- echo RUNNING COMMAND $cmd
- $cmd
+ shift ; shift
+ echo RUNNING COMMAND $cmd $*
+ $cmd $*
exit $?
fi
if [ "$1" = '-gunicorn' ] ; then
@@ -198,7 +205,8 @@ if [ "$1" = '-gunicorn-prod' ] ; 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=32 --max-requests 1000 --timeout 1200 wsgi"
+ PID=$TMPDIR/gunicorn.$USER.pid
+ cmd="--bind 0.0.0.0:$SERVER_PORT --pid $PID -k eventlet --workers 20 --keep-alive 1200 --max-requests 1000 --timeout 1200 wsgi"
echo RUNNING gunicorn $cmd
gunicorn $cmd
exit $?
diff --git a/bin/mechnical-rob b/bin/mechnical-rob
new file mode 100755
index 00000000..be223d94
--- /dev/null
+++ b/bin/mechnical-rob
@@ -0,0 +1,111 @@
+#!/usr/bin/env ruby
+
+
+USAGE = <<EOT
+This is Mechanical-Rob - an automated web server tester for
+ Genenetwork.org that uses the brilliant
+ mechanize gem with minitest.
+
+To use this software you need to install mechanize. Run it from
+the root of the genenetwork2 source tree as, for example,
+
+ ./bin/test-website http://localhost:5003/ (default)
+
+If you are using the small deployment database you can use
+
+ ./bin/test-website --skip -n
+
+To run all tests
+
+ ./bin/test-website --all
+
+To run individual tests on localhost you can do
+
+ ruby -Itest -Itest/lib test/lib/mapping.rb --name="/Mapping/"
+
+For more information see http://genenetwork.org/
+
+EOT
+$stderr.print USAGE
+
+require 'optparse'
+
+options = { database: :small, link_checker: false}
+opts = OptionParser.new do |o|
+ o.banner = "Usage: #{File.basename($0)} [options] URL"
+
+ o.on('-d','--database', String, 'Use database (default db_webqtl_s)') do |s|
+ options[:database] =
+ case s
+ when 'xx'
+ :unknown
+ else
+ :small
+ end
+ end
+
+ o.on('--all', 'Run all tests') do
+ options[:all] = true
+ end
+
+ o.on('-l','--link-checker', 'Check for dead links') do
+ options[:link_checker] = true
+ end
+
+ o.on('--navigation', 'Check for navigation') do
+ options[:navigation] = true
+ end
+
+ o.on('--mapping', 'Check for mapping') do
+ options[:mapping] = true
+ end
+
+ o.on('--skip-broken', 'Skip tests that are known to be broken') do
+ options[:skip_broken] = true
+ end
+
+ o.separator ""
+ o.on_tail('-h', '--help', 'display this help and exit') do
+ options[:show_help] = true
+ end
+end
+
+opts.parse!(ARGV)
+
+if options[:show_help]
+ print opts
+ exit 1
+end
+
+$options = options # we are using a global here
+$host =
+ if ARGV.size>0
+ ARGV.shift
+ else
+ "http://localhost:5003"
+ end
+
+$stderr.print "Testing <",$host,">\n"
+
+require 'mechanize'
+require 'minitest/spec'
+require 'minitest/autorun'
+
+# These are the actual testing modules
+
+libpath = File.dirname(File.dirname(__FILE__))
+$: << File.join(libpath,'test/lib')
+
+require 'main_web_functionality'
+
+if options[:all] or options[:mapping]
+ require 'mapping'
+end
+
+if options[:all] or options[:link_checker]
+ require 'link_checker'
+end
+
+if options[:all] or options[:navigation]
+ require 'navigation'
+end
diff --git a/bin/test-website b/bin/test-website
index be223d94..5935f016 100755
--- a/bin/test-website
+++ b/bin/test-website
@@ -1,111 +1,7 @@
-#!/usr/bin/env ruby
+#! /bin/bash
-
-USAGE = <<EOT
-This is Mechanical-Rob - an automated web server tester for
- Genenetwork.org that uses the brilliant
- mechanize gem with minitest.
-
-To use this software you need to install mechanize. Run it from
-the root of the genenetwork2 source tree as, for example,
-
- ./bin/test-website http://localhost:5003/ (default)
-
-If you are using the small deployment database you can use
-
- ./bin/test-website --skip -n
-
-To run all tests
-
- ./bin/test-website --all
-
-To run individual tests on localhost you can do
-
- ruby -Itest -Itest/lib test/lib/mapping.rb --name="/Mapping/"
-
-For more information see http://genenetwork.org/
-
-EOT
-$stderr.print USAGE
-
-require 'optparse'
-
-options = { database: :small, link_checker: false}
-opts = OptionParser.new do |o|
- o.banner = "Usage: #{File.basename($0)} [options] URL"
-
- o.on('-d','--database', String, 'Use database (default db_webqtl_s)') do |s|
- options[:database] =
- case s
- when 'xx'
- :unknown
- else
- :small
- end
- end
-
- o.on('--all', 'Run all tests') do
- options[:all] = true
- end
-
- o.on('-l','--link-checker', 'Check for dead links') do
- options[:link_checker] = true
- end
-
- o.on('--navigation', 'Check for navigation') do
- options[:navigation] = true
- end
-
- o.on('--mapping', 'Check for mapping') do
- options[:mapping] = true
- end
-
- o.on('--skip-broken', 'Skip tests that are known to be broken') do
- options[:skip_broken] = true
- end
-
- o.separator ""
- o.on_tail('-h', '--help', 'display this help and exit') do
- options[:show_help] = true
- end
-end
-
-opts.parse!(ARGV)
-
-if options[:show_help]
- print opts
+if [ -z $GN2_PROFILE ]; then
+ echo "Run request tests with something like"
+ echo env GN2_PROFILE=/home/wrk/opt/gn-latest ./bin/genenetwork2 ./etc/default_settings.py -c ../test/requests/test-website.py http://localhost:5003
exit 1
-end
-
-$options = options # we are using a global here
-$host =
- if ARGV.size>0
- ARGV.shift
- else
- "http://localhost:5003"
- end
-
-$stderr.print "Testing <",$host,">\n"
-
-require 'mechanize'
-require 'minitest/spec'
-require 'minitest/autorun'
-
-# These are the actual testing modules
-
-libpath = File.dirname(File.dirname(__FILE__))
-$: << File.join(libpath,'test/lib')
-
-require 'main_web_functionality'
-
-if options[:all] or options[:mapping]
- require 'mapping'
-end
-
-if options[:all] or options[:link_checker]
- require 'link_checker'
-end
-
-if options[:all] or options[:navigation]
- require 'navigation'
-end
+fi