mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-29 17:42:12 +08:00
Use consistent preference order for config files
1) galaxy.yml 2) galaxy.ini 3) universe_wsgi.ini Also: - properly quote variables which may contain spaces - no need to pass the config file to `./scripts/manage_tool_dependencies.py` - simplify `scripts/maintenance.sh` by moving the `cd` up and reusing functions from `scripts/common_startup_functions.sh`
This commit is contained in:
@@ -87,9 +87,16 @@ setup_python() {
|
||||
python ./scripts/check_python.py || exit 1
|
||||
}
|
||||
|
||||
set_galaxy_config_file_var() {
|
||||
if [ -z "$GALAXY_CONFIG_FILE" ]; then
|
||||
GALAXY_CONFIG_FILE=$(PYTHONPATH=lib python -c "from __future__ import print_function; from galaxy.util.properties import find_config_file; print(find_config_file(['galaxy', 'universe_wsgi']) or '')")
|
||||
export GALAXY_CONFIG_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
find_server() {
|
||||
server_config="$1"
|
||||
server_app="$2"
|
||||
server_config=$1
|
||||
server_app=$2
|
||||
arg_getter_args=
|
||||
default_webserver="paste"
|
||||
case "$server_config" in
|
||||
@@ -110,17 +117,17 @@ find_server() {
|
||||
echo 'ERROR: Could not find uwsgi executable'
|
||||
exit 1
|
||||
fi
|
||||
[ "$server_config" != "none" ] && arg_getter_args="-c $server_config"
|
||||
[ "$server_config" != "none" ] && arg_getter_args="-c \"$server_config\""
|
||||
[ -n "$server_app" ] && arg_getter_args="--app $server_app"
|
||||
run_server="$UWSGI"
|
||||
server_args=
|
||||
if [ -z "$stop_daemon_arg_set" -a -z "$restart_arg_set" ]; then
|
||||
server_args="$(python ./scripts/get_uwsgi_args.py $arg_getter_args)"
|
||||
server_args="$(eval python ./scripts/get_uwsgi_args.py $arg_getter_args)"
|
||||
fi
|
||||
server_args="$server_args $uwsgi_args"
|
||||
pid_log_paster_args=""
|
||||
else
|
||||
run_server="python"
|
||||
server_args="./scripts/paster.py serve $server_config $paster_args"
|
||||
server_args="./scripts/paster.py serve \"$server_config\" $paster_args"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This file is sourced in the maintenance.sh script and could be sourced in ./run.sh or ./run_reports.sh
|
||||
SCRIPTLOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# If there is a file that defines a shell environment specific to this
|
||||
# instance of Galaxy, source the file.
|
||||
if [ -z $GALAXY_LOCAL_ENV_FILE ];
|
||||
then
|
||||
GALAXY_LOCAL_ENV_FILE="$SCRIPTLOCATION/../config/local_env.sh"
|
||||
fi
|
||||
|
||||
if [ -f $GALAXY_LOCAL_ENV_FILE ];
|
||||
then
|
||||
echo "Activating local env file: $GALAXY_LOCAL_ENV_FILE"
|
||||
. $GALAXY_LOCAL_ENV_FILE
|
||||
fi
|
||||
|
||||
# If there is a .venv/ directory, assume it contains a virtualenv that we
|
||||
# should run this instance in.
|
||||
GALAXY_VIRTUAL_ENV="${GALAXY_VIRTUAL_ENV:-$SCRIPTLOCATION/../.venv}"
|
||||
if [ -d "$GALAXY_VIRTUAL_ENV" -a -z "$skip_venv" ];
|
||||
then
|
||||
[ -n "$PYTHONPATH" ] && { echo 'Unsetting $PYTHONPATH'; unset PYTHONPATH; }
|
||||
echo "Activating virtualenv at $GALAXY_VIRTUAL_ENV"
|
||||
. "$GALAXY_VIRTUAL_ENV/bin/activate"
|
||||
fi
|
||||
if [ -z "$GALAXY_CONFIG_FILE" ]; then
|
||||
if [ -f "$SCRIPTLOCATION/../universe_wsgi.ini" ]; then
|
||||
GALAXY_CONFIG_FILE=universe_wsgi.ini
|
||||
elif [ -f "$SCRIPTLOCATION/../config/galaxy.ini" ]; then
|
||||
GALAXY_CONFIG_FILE=config/galaxy.ini
|
||||
else
|
||||
GALAXY_CONFIG_FILE=config/galaxy.ini.sample
|
||||
fi
|
||||
export GALAXY_CONFIG_FILE
|
||||
fi
|
||||
|
||||
echo "GALAXY_CONFIG_FILE: ${GALAXY_CONFIG_FILE}"
|
||||
+16
-12
@@ -52,8 +52,13 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
SCRIPTLOCATION="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source ${SCRIPTLOCATION}/common_startup_variables.sh
|
||||
cd "$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"/../
|
||||
|
||||
. scripts/common_startup_functions.sh
|
||||
|
||||
setup_python
|
||||
|
||||
set_galaxy_config_file_var
|
||||
|
||||
if [ "$DRYRUN" = true ]; then
|
||||
MODE="--info_only"
|
||||
@@ -61,14 +66,14 @@ else
|
||||
MODE="-r"
|
||||
fi
|
||||
|
||||
MAINTENANCE_LOG="$SCRIPTLOCATION/../maintenance.log"
|
||||
MAINTENANCE_LOG=maintenance.log
|
||||
COMMANDS=(
|
||||
"python $SCRIPTLOCATION/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --delete_userless_histories >> $MAINTENANCE_LOG"
|
||||
"python $SCRIPTLOCATION/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_histories >> $MAINTENANCE_LOG"
|
||||
"python $SCRIPTLOCATION/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_datasets >> $MAINTENANCE_LOG"
|
||||
"python $SCRIPTLOCATION/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_folders >> $MAINTENANCE_LOG"
|
||||
"python $SCRIPTLOCATION/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --delete_datasets >> $MAINTENANCE_LOG"
|
||||
"python $SCRIPTLOCATION/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_datasets >> $MAINTENANCE_LOG")
|
||||
"python scripts/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --delete_userless_histories >> $MAINTENANCE_LOG"
|
||||
"python scripts/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_histories >> $MAINTENANCE_LOG"
|
||||
"python scripts/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_datasets >> $MAINTENANCE_LOG"
|
||||
"python scripts/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_folders >> $MAINTENANCE_LOG"
|
||||
"python scripts/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --delete_datasets >> $MAINTENANCE_LOG"
|
||||
"python scripts/cleanup_datasets/cleanup_datasets.py $GALAXY_CONFIG_FILE -d $DAYS $MODE --purge_datasets >> $MAINTENANCE_LOG")
|
||||
|
||||
printf "\nDry run: $DRYRUN\nDays: $DAYS\n\n"
|
||||
echo "Will run following commands and output in $MAINTENANCE_LOG"
|
||||
@@ -77,15 +82,14 @@ for (( i = 0; i < ${#COMMANDS[@]} ; i++ )); do
|
||||
done
|
||||
|
||||
if [ "$DRYRUN" = false ]; then
|
||||
echo "python $SCRIPTLOCATION/set_user_disk_usage.py >> $MAINTENANCE_LOG"
|
||||
echo "python scripts/set_user_disk_usage.py >> $MAINTENANCE_LOG"
|
||||
fi
|
||||
|
||||
# Run the commands
|
||||
cd $SCRIPTLOCATION/../
|
||||
for (( i = 0; i < ${#COMMANDS[@]} ; i++ )); do
|
||||
eval "${COMMANDS[$i]}"
|
||||
done
|
||||
|
||||
if [ "$DRYRUN" = false ]; then
|
||||
python $SCRIPTLOCATION/set_user_disk_usage.py >> $MAINTENANCE_LOG
|
||||
python scripts/set_user_disk_usage.py >> $MAINTENANCE_LOG
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user