1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/92ea25658bd1/ changeset: 92ea25658bd1 user: natefoo date: 2011-10-06 19:41:27 summary: A much more efficient query for calculating a history's disk usage. affected #: 1 file (-1 bytes) --- a/lib/galaxy/model/__init__.py Thu Oct 06 12:27:48 2011 -0400 +++ b/lib/galaxy/model/__init__.py Thu Oct 06 13:41:27 2011 -0400 @@ -17,6 +17,7 @@ from galaxy.web.form_builder import * from galaxy.model.item_attrs import UsesAnnotations, APIItem from sqlalchemy.orm import object_session +from sqlalchemy.sql.expression import func import os.path, os, errno, codecs, operator, socket, pexpect, logging, time, shutil if sys.version_info[:2] < ( 2, 5 ): @@ -468,7 +469,12 @@ return self.get_disk_size( nice_size=False ) def get_disk_size( self, nice_size=False ): # unique datasets only - rval = sum( [ d.get_total_size() for d in list( set( [ hda.dataset for hda in self.datasets if not hda.purged ] ) ) if not d.purged ] ) + db_session = object_session( self ) + rval = db_session.query( func.sum( db_session.query( HistoryDatasetAssociation.dataset_id, Dataset.total_size ).join( Dataset ) + .filter( HistoryDatasetAssociation.table.c.history_id == self.id ) + .distinct().subquery().c.total_size ) ).first()[0] + if rval is None: + rval = 0 if nice_size: rval = galaxy.datatypes.data.nice_size( rval ) return rval 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.