
Louise, The original code would not eliminate a dataset file that was pointed to by a LibraryDatasetDatasetAssociation, and then imported from the data library into the user's history, creating a HistoryDatasetAssociation that points to the same file. I've added a bit of code below that should eliminate datasets falling into this category - not tested at all though... On May 17, 2011, at 8:42 AM, Louise-Amelie Schmitt wrote:
But I still have a question: It comprises the datasets stored in libraries right? Is there a way to ignore them?
Greg Von Kuster wrote:
Hello Louise,
I've pasted a diff below for the file ~/lib/galaxy/web/controller/admin.py that will provide what you want, I believe. I didn't have time to fully test, but it gives you the idea. You can make things prettier by wrapping the returned value in galaxy.datatypes.data.nice_size
diff -r 56be3f4871cd lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py Fri May 13 21:24:03 2011 -0400 +++ b/lib/galaxy/web/controllers/admin.py Mon May 16 14:15:23 2011 -0400 @@ -41,6 +41,13 @@ if user.galaxy_sessions: return self.format( user.galaxy_sessions[ 0 ].update_time ) return 'never' + class DiskUseageColumn( grids.GridColumn ): + def get_value( self, trans, grid, user ): + disk_used = 0 + for history in user.active_histories: + for hda in history.active_datasets:
dataset = hda.dataset if not dataset.active_library_associations:
+ disk_used += hda.get_size()
+ return disk_used # Grid definition webapp = "galaxy" @@ -65,6 +72,7 @@ ExternalColumn( "External", attach_popup=False ), LastLoginColumn( "Last Login", format=time_ago ), StatusColumn( "Status", attach_popup=False ), + DiskUseageColumn( "Disk Used", attach_popup=False ), # Columns that are valid for filtering but are not visible. grids.DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" ) ]
On May 16, 2011, at 10:18 AM, Louise-Amelie Schmitt wrote:
Hello
I would like to add a column in the admin panel's user list with the sum of the file size of every dataset in each user's histories that don't belong to any ibrary.
Is there a way to do that?
I had a look at lib/galaxy/web/controller/admin.py and templates/grid_base.mako but I fail to see where the "query" variable (containing the items, therefore the users) come from in the mako template, so I didn't figure out what each column class in admin.py actually manipulates in the get_value() methods.
Regards, L-A ___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at:
Greg Von Kuster Galaxy Development Team greg@bx.psu.edu <mailto:greg@bx.psu.edu>
Greg Von Kuster Galaxy Development Team greg@bx.psu.edu