From 1d5f59a3c38ef23b98089873659529752f89de97 Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Fri, 18 Apr 2008 13:53:15 +0000 Subject: [PATCH] Updated dataset cleanup scripts to use eggs lib. --- scripts/cleanup_datasets/cleanup_datasets.py | 8 +++++++- scripts/cleanup_datasets/delete_userless_histories.sh | 9 ++------- scripts/cleanup_datasets/purge_datasets.sh | 9 ++------- scripts/cleanup_datasets/purge_histories.sh | 9 ++------- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/scripts/cleanup_datasets/cleanup_datasets.py b/scripts/cleanup_datasets/cleanup_datasets.py index 8781fbab91a..1764b6a7357 100644 --- a/scripts/cleanup_datasets/cleanup_datasets.py +++ b/scripts/cleanup_datasets/cleanup_datasets.py @@ -3,6 +3,12 @@ import sys, os, time, ConfigParser from datetime import datetime, timedelta from optparse import OptionParser + +new_path = [ os.path.join( os.getcwd(), "lib" ) ] +new_path.extend( sys.path[1:] ) # remove scripts/ from the path +sys.path = new_path + +from galaxy import eggs import galaxy.model.mapping import pkg_resources @@ -279,4 +285,4 @@ class CleanupDatasetsApplication( object ): self.model = galaxy.model.mapping.init( self.file_path, self.database_connection, engine_options={}, create_tables=False ) if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/scripts/cleanup_datasets/delete_userless_histories.sh b/scripts/cleanup_datasets/delete_userless_histories.sh index cd16f528b41..3c2e87974f6 100644 --- a/scripts/cleanup_datasets/delete_userless_histories.sh +++ b/scripts/cleanup_datasets/delete_userless_histories.sh @@ -1,9 +1,4 @@ #!/bin/sh -# This script must be executed from the $UNIVERSE_HOME directory -# e.g., sh ./scripts/cleanup_datasets/purge_delete_userless_histories.sh - -. ./scripts/get_python.sh -. ./setup_paths.sh - -$GALAXY_PYTHON ./scripts/cleanup_datasets/cleanup_datasets.py ./universe_wsgi.ini -d 10 -2 $@ >> ./scripts/cleanup_datasets/delete_userless_histories.log +cd `dirname $0`/../.. +python ./scripts/cleanup_datasets/cleanup_datasets.py ./universe_wsgi.ini -d 10 -2 $@ >> ./scripts/cleanup_datasets/delete_userless_histories.log diff --git a/scripts/cleanup_datasets/purge_datasets.sh b/scripts/cleanup_datasets/purge_datasets.sh index edd0ec005dd..3a0a53df136 100644 --- a/scripts/cleanup_datasets/purge_datasets.sh +++ b/scripts/cleanup_datasets/purge_datasets.sh @@ -1,9 +1,4 @@ #!/bin/sh -# This script must be executed from the $UNIVERSE_HOME directory -# e.g., sh ./scripts/cleanup_datasets/purge_datasets.sh - -. ./scripts/get_python.sh -. ./setup_paths.sh - -$GALAXY_PYTHON ./scripts/cleanup_datasets/cleanup_datasets.py ./universe_wsgi.ini -d 10 -6 -r $@ >> ./scripts/cleanup_datasets/purge_datasets.log +cd `dirname $0`/../.. +python ./scripts/cleanup_datasets/cleanup_datasets.py ./universe_wsgi.ini -d 10 -6 -r $@ >> ./scripts/cleanup_datasets/purge_datasets.log diff --git a/scripts/cleanup_datasets/purge_histories.sh b/scripts/cleanup_datasets/purge_histories.sh index 438aef72574..9416c11a4f9 100644 --- a/scripts/cleanup_datasets/purge_histories.sh +++ b/scripts/cleanup_datasets/purge_histories.sh @@ -1,9 +1,4 @@ #!/bin/sh -# This script must be executed from the $UNIVERSE_HOME directory -# e.g., sh ./scripts/cleanup_datasets/purge_histories.sh - -. ./scripts/get_python.sh -. ./setup_paths.sh - -$GALAXY_PYTHON ./scripts/cleanup_datasets/cleanup_datasets.py ./universe_wsgi.ini -d 10 -4 -r $@ >> ./scripts/cleanup_datasets/purge_histories.log +cd `dirname $0`/../.. +python ./scripts/cleanup_datasets/cleanup_datasets.py ./universe_wsgi.ini -d 10 -4 -r $@ >> ./scripts/cleanup_datasets/purge_histories.log