Skip to content

Commit

Permalink
Merge branch 'release_15.07' into dev
Browse files Browse the repository at this point in the history
Conflicts:
	lib/galaxy/model/__init__.py
  • Loading branch information
nsoranzo committed Aug 20, 2015
2 parents c429777 + a34f13a commit 0f883ef
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
12 changes: 5 additions & 7 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,13 +1619,11 @@ def set_size( self ):
def get_total_size( self ):
if self.total_size is not None:
return self.total_size
if self.file_size:
# for backwards compatibility, set if unset
self.set_total_size()
db_session = object_session( self )
db_session.flush()
return self.total_size
return 0
# for backwards compatibility, set if unset
self.set_total_size()
db_session = object_session( self )
db_session.flush()
return self.total_size

def set_total_size( self ):
if self.file_size is None:
Expand Down
2 changes: 1 addition & 1 deletion scripts/cleanup_datasets/cleanup_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def _purge_dataset( app, dataset, remove_from_disk, info_only=False ):
if hda.history.user is not None and hda.history.user not in usage_users:
usage_users.append( hda.history.user )
for user in usage_users:
user.total_disk_usage -= dataset.total_size
user.total_disk_usage -= dataset.get_total_size()
app.sa_session.add( user )
print "Purging dataset id", dataset.id
dataset.purged = True
Expand Down
17 changes: 16 additions & 1 deletion test/unit/test_galaxy_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def new_hda( self, history, **kwds ):
@classmethod
def setUpClass(cls):
# Start the database and connect the mapping
cls.model = mapping.init( "/tmp", "sqlite:///:memory:", create_tables=True )
cls.model = mapping.init( "/tmp", "sqlite:///:memory:", create_tables=True, object_store=MockObjectStore() )
assert cls.model.engine is not None

@classmethod
Expand Down Expand Up @@ -439,6 +439,21 @@ def expunge(cls):
cls.model.session.expunge_all()


class MockObjectStore(object):

def __init__(self):
pass

def size(self, dataset):
return 42

def exists(self, *args, **kwds):
return True

def get_filename(self, *args, **kwds):
return "dataest_14.dat"


def get_suite():
suite = unittest.TestSuite()
suite.addTest( MappingTests( "test_basic" ) )
Expand Down

0 comments on commit 0f883ef

Please sign in to comment.