Skip to content

Commit 238d908

Browse files
committed
Fix purging datasets whose total_size is None.
Fix the error: Removing disk, file /opt/galaxy/database/files/000/dataset_192.dat Error attempting to purge data file: /opt/galaxy/database/files/000/dataset_192.dat error: unsupported operand type(s) for -=: 'Decimal' and 'NoneType' when running: python scripts/cleanup_datasets/cleanup_datasets.py config/galaxy.ini -d 10 -3 -r
1 parent f01300d commit 238d908

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

lib/galaxy/model/__init__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,13 +1434,11 @@ def set_size( self ):
14341434
def get_total_size( self ):
14351435
if self.total_size is not None:
14361436
return self.total_size
1437-
if self.file_size:
1438-
# for backwards compatibility, set if unset
1439-
self.set_total_size()
1440-
db_session = object_session( self )
1441-
db_session.flush()
1442-
return self.total_size
1443-
return 0
1437+
# for backwards compatibility, set if unset
1438+
self.set_total_size()
1439+
db_session = object_session( self )
1440+
db_session.flush()
1441+
return self.total_size
14441442
def set_total_size( self ):
14451443
if self.file_size is None:
14461444
self.set_size()

scripts/cleanup_datasets/cleanup_datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def _purge_dataset( app, dataset, remove_from_disk, info_only = False ):
465465
if hda.history.user is not None and hda.history.user not in usage_users:
466466
usage_users.append( hda.history.user )
467467
for user in usage_users:
468-
user.total_disk_usage -= dataset.total_size
468+
user.total_disk_usage -= dataset.get_total_size()
469469
app.sa_session.add( user )
470470
print "Purging dataset id", dataset.id
471471
dataset.purged = True

0 commit comments

Comments
 (0)