1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/ee2feed164a9/ changeset: ee2feed164a9 user: natefoo date: 2012-09-28 22:11:38 summary: pgcleanup/set_user_disk_usage: set usage to 0, not null, when the user has no active data. affected #: 2 files diff -r cfd26c91f6c3bb8b6365e7835263e11fc3013004 -r ee2feed164a9efc9201409b3e6191e2707ec3e18 scripts/cleanup_datasets/pgcleanup.py --- a/scripts/cleanup_datasets/pgcleanup.py +++ b/scripts/cleanup_datasets/pgcleanup.py @@ -261,7 +261,7 @@ # TODO: h.purged = false should be unnecessary once all hdas in purged histories are purged. sql = """ UPDATE galaxy_user - SET disk_usage = (SELECT SUM(total_size) + SET disk_usage = (SELECT COALESCE(SUM(total_size), 0) FROM ( SELECT d.total_size FROM history_dataset_association hda JOIN history h ON h.id = hda.history_id diff -r cfd26c91f6c3bb8b6365e7835263e11fc3013004 -r ee2feed164a9efc9201409b3e6191e2707ec3e18 scripts/set_user_disk_usage.py --- a/scripts/set_user_disk_usage.py +++ b/scripts/set_user_disk_usage.py @@ -30,6 +30,9 @@ import galaxy.config from galaxy.objectstore import build_object_store_from_config + # lazy + globals()['nice_size'] = __import__( 'galaxy.util', globals(), locals(), ( 'nice_size', ) ).nice_size + config_parser = ConfigParser( dict( here = os.getcwd(), database_connection = 'sqlite:///database/universe.sqlite?isolation_level=IMMEDIATE' ) ) config_parser.read( os.path.basename( options.config ) ) @@ -48,7 +51,7 @@ def pgcalc( sa_session, id ): sql = """ UPDATE galaxy_user - SET disk_usage = (SELECT SUM(total_size) + SET disk_usage = (SELECT COALESCE(SUM(total_size), 0) FROM ( SELECT d.total_size FROM history_dataset_association hda JOIN history h ON h.id = hda.history_id @@ -72,7 +75,7 @@ def quotacheck( sa_session, users, engine ): sa_session.refresh( user ) current = user.get_disk_usage() - print user.username, '<' + user.email + '> old usage:', str( current ) + ',', + print user.username, '<' + user.email + '>:', if engine != 'postgres': new = user.calculate_disk_usage() sa_session.refresh( user ) @@ -83,10 +86,14 @@ else: new = pgcalc( sa_session, user.id ) # yes, still a small race condition between here and the flush - if new == current: - print 'no change' + print 'old usage:', nice_size( current ), 'change:', + if new in ( current, None ): + print 'none' else: - print 'new usage:', new + op = '-' + if new > current: + op = '+' + print '%s%s' % ( op, nice_size( new ) ) if not options.dryrun and engine != 'postgres': user.set_disk_usage( new ) sa_session.add( user ) 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.