2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/4dee72426a65/ changeset: 4dee72426a65 user: jmchilton date: 2012-09-22 05:04:15 summary: Improvements to reports management script (run_reports.sh) to enable managing the reports app from CloudMan. These enhancements are all "optional", the default behavior of run_reports.sh is unchanged. Added flag (--sync-config) to run_reports.sh script that will cause it to synchronize the database connection and file path properties in reports_wsgi.ini with those in universe_wsgi.ini prior to starting paster app. Allow specification of reports configuration directory mirroring similar extensions previously accepted for universe config and run.sh Added usage documentation to run_reports.sh. Added extension points to tweak pid and log location for reports application via environment variables. affected #: 3 files diff -r 3574c1fa4cb3494f82fd1915c63da6154b230756 -r 4dee72426a656988fdf6c70c2c3ff4ba9774fb5c run_reports.sh --- a/run_reports.sh +++ b/run_reports.sh @@ -1,4 +1,29 @@ #!/bin/sh + +# Usage: ./run_reports.sh [--sync-config] <start|stop> +# +# +# Description: This script can be used to start or stop the galaxy +# reports web application. Passing in --sync-config as the first +# argument to this will cause Galaxy's database and path parameters +# from universe_wsgi.ini to be copied over into reports_wsgi.ini. + cd `dirname $0` -python ./scripts/paster.py serve reports_wsgi.ini --pid-file=reports_webapp.pid --log-file=reports_webapp.log $@ + +GALAXY_REPORTS_CONFIG=${GALAXY_REPORTS_CONFIG:-reports_wsgi.ini} +GALAXY_REPORTS_PID=${GALAXY_REPORTS_PID:-reports_webapp.pid} +GALAXY_REPORTS_LOG=${GALAXY_REPORTS_LOG:-reports_webapp.log} + +if [ -n "$GALAXY_REPORTS_CONFIG_DIR" ]; then + python ./scripts/build_universe_config.py "$GALAXY_REPORTS_CONFIG_DIR" "$GALAXY_REPORTS_CONFIG" +fi + + +if [ "$1" = "--sync-config" ]; +then + python ./scripts/sync_reports_config.py + shift +fi + +python ./scripts/paster.py serve "$GALAXY_REPORTS_CONFIG" --pid-file="$GALAXY_REPORTS_PID" --log-file="$GALAXY_REPORTS_LOG" $@ diff -r 3574c1fa4cb3494f82fd1915c63da6154b230756 -r 4dee72426a656988fdf6c70c2c3ff4ba9774fb5c scripts/build_universe_config.py --- a/scripts/build_universe_config.py +++ b/scripts/build_universe_config.py @@ -20,7 +20,11 @@ ## TODO: Expand enviroment variables here, that would ## also make Galaxy much easier to configure. - parser.write(open("universe_wsgi.ini", 'w')) + destination= "universe_wsgi.ini" + if len(argv) > 2: + destination = argv[2] + + parser.write(open(destination, 'w')) if __name__ == '__main__': merge() diff -r 3574c1fa4cb3494f82fd1915c63da6154b230756 -r 4dee72426a656988fdf6c70c2c3ff4ba9774fb5c scripts/sync_reports_config.py --- /dev/null +++ b/scripts/sync_reports_config.py @@ -0,0 +1,58 @@ +from ConfigParser import ConfigParser +from sys import argv + +REPLACE_PROPERTIES = ["file_path", "database_connection", "new_file_path"] +MAIN_SECTION = "app:main" + +def sync(): + # Add or replace the relevant properites from universe_wsgi.ini + # into reports_wsgi.ini + reports_config_file = "reports_wsgi.ini" + if len(argv) > 1: + reports_config_file = argv[1] + + universe_config_file = "universe_wsgi.ini" + if len(argv) > 2: + universe_config_file = argv[2] + + parser = ConfigParser() + parser.read(universe_config_file) + + with open(reports_config_file, "r") as f: + reports_config_lines = f.readlines() + + replaced_properties = set([]) + with open(reports_config_file, "w") as f: + # Write all properties from reports config replacing as + # needed. + for reports_config_line in reports_config_lines: + (line, replaced_property) = get_synced_line(reports_config_line, parser) + if replaced_property: + replaced_properties.add(replaced_property) + f.write(line) + + # If any properties appear in universe config and not in + # reports write these as well. + for replacement_property in REPLACE_PROPERTIES: + if parser.has_option(MAIN_SECTION, replacement_property) and \ + not (replacement_property in replaced_properties): + f.write(get_universe_line(replacement_property, parser)) + +def get_synced_line(reports_line, universe_config): + # Cycle through properties to replace and perform replacement on + # this line if needed. + synced_line = reports_line + replaced_property = None + for replacement_property in REPLACE_PROPERTIES: + if reports_line.startswith(replacement_property) and \ + universe_config.has_option(MAIN_SECTION, replacement_property): + synced_line = get_universe_line(replacement_property, universe_config) + replaced_property = replacement_property + break + return (synced_line, replaced_property) + +def get_universe_line(property_name, universe_config): + return "%s=%s\n" % (property_name, universe_config.get(MAIN_SECTION, property_name)) + +if __name__ == '__main__': + sync() https://bitbucket.org/galaxy/galaxy-central/changeset/15543df2c242/ changeset: 15543df2c242 user: dannon date: 2012-11-12 18:00:18 summary: Merged in jmchilton/galaxy-central-reports-config-enhancements (pull request #71) affected #: 3 files diff -r 38ce114e06f965dfd7eca383849a91b07d1473c6 -r 15543df2c2428ffadbce946433ae43edff8cb197 run_reports.sh --- a/run_reports.sh +++ b/run_reports.sh @@ -1,4 +1,29 @@ #!/bin/sh + +# Usage: ./run_reports.sh [--sync-config] <start|stop> +# +# +# Description: This script can be used to start or stop the galaxy +# reports web application. Passing in --sync-config as the first +# argument to this will cause Galaxy's database and path parameters +# from universe_wsgi.ini to be copied over into reports_wsgi.ini. + cd `dirname $0` -python ./scripts/paster.py serve reports_wsgi.ini --pid-file=reports_webapp.pid --log-file=reports_webapp.log $@ + +GALAXY_REPORTS_CONFIG=${GALAXY_REPORTS_CONFIG:-reports_wsgi.ini} +GALAXY_REPORTS_PID=${GALAXY_REPORTS_PID:-reports_webapp.pid} +GALAXY_REPORTS_LOG=${GALAXY_REPORTS_LOG:-reports_webapp.log} + +if [ -n "$GALAXY_REPORTS_CONFIG_DIR" ]; then + python ./scripts/build_universe_config.py "$GALAXY_REPORTS_CONFIG_DIR" "$GALAXY_REPORTS_CONFIG" +fi + + +if [ "$1" = "--sync-config" ]; +then + python ./scripts/sync_reports_config.py + shift +fi + +python ./scripts/paster.py serve "$GALAXY_REPORTS_CONFIG" --pid-file="$GALAXY_REPORTS_PID" --log-file="$GALAXY_REPORTS_LOG" $@ diff -r 38ce114e06f965dfd7eca383849a91b07d1473c6 -r 15543df2c2428ffadbce946433ae43edff8cb197 scripts/build_universe_config.py --- a/scripts/build_universe_config.py +++ b/scripts/build_universe_config.py @@ -20,7 +20,11 @@ ## TODO: Expand enviroment variables here, that would ## also make Galaxy much easier to configure. - parser.write(open("universe_wsgi.ini", 'w')) + destination= "universe_wsgi.ini" + if len(argv) > 2: + destination = argv[2] + + parser.write(open(destination, 'w')) if __name__ == '__main__': merge() diff -r 38ce114e06f965dfd7eca383849a91b07d1473c6 -r 15543df2c2428ffadbce946433ae43edff8cb197 scripts/sync_reports_config.py --- /dev/null +++ b/scripts/sync_reports_config.py @@ -0,0 +1,58 @@ +from ConfigParser import ConfigParser +from sys import argv + +REPLACE_PROPERTIES = ["file_path", "database_connection", "new_file_path"] +MAIN_SECTION = "app:main" + +def sync(): + # Add or replace the relevant properites from universe_wsgi.ini + # into reports_wsgi.ini + reports_config_file = "reports_wsgi.ini" + if len(argv) > 1: + reports_config_file = argv[1] + + universe_config_file = "universe_wsgi.ini" + if len(argv) > 2: + universe_config_file = argv[2] + + parser = ConfigParser() + parser.read(universe_config_file) + + with open(reports_config_file, "r") as f: + reports_config_lines = f.readlines() + + replaced_properties = set([]) + with open(reports_config_file, "w") as f: + # Write all properties from reports config replacing as + # needed. + for reports_config_line in reports_config_lines: + (line, replaced_property) = get_synced_line(reports_config_line, parser) + if replaced_property: + replaced_properties.add(replaced_property) + f.write(line) + + # If any properties appear in universe config and not in + # reports write these as well. + for replacement_property in REPLACE_PROPERTIES: + if parser.has_option(MAIN_SECTION, replacement_property) and \ + not (replacement_property in replaced_properties): + f.write(get_universe_line(replacement_property, parser)) + +def get_synced_line(reports_line, universe_config): + # Cycle through properties to replace and perform replacement on + # this line if needed. + synced_line = reports_line + replaced_property = None + for replacement_property in REPLACE_PROPERTIES: + if reports_line.startswith(replacement_property) and \ + universe_config.has_option(MAIN_SECTION, replacement_property): + synced_line = get_universe_line(replacement_property, universe_config) + replaced_property = replacement_property + break + return (synced_line, replaced_property) + +def get_universe_line(property_name, universe_config): + return "%s=%s\n" % (property_name, universe_config.get(MAIN_SECTION, property_name)) + +if __name__ == '__main__': + sync() Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.