Hi,

I'm trying to use the built-in cleanup scripts (instead of my own), came across 
a possible bug:

1. When running "delete_datasets.sh", the "info_only" flag is ignored.
This is evident by running it twice with "-i" and getting different results 
(the second time - no datasets are deleted).

2. When running "purge_datasets.sh" with the "info_only" flag, no information 
is printed at all, making it impossible to know what would be purged without 
the "-i" flag.
The only way to see what is purged is actually purging the datasets (kind of 
defeats the purpose of "info only").

I think the attached patch fixes both issues.


3. The relevant wiki page 
(https://bitbucket.org/galaxy/galaxy-central/wiki/Config/PurgeHistoriesAndDatasets)
 says about "delete_datasets.sh": "The purge_datasets.sh script will need to be 
run afterwards to remove the base datasets from disk."

But the example on the wiki page (and in the script) has "-r" - so the files 
are actually deleted from the disk by "delete_datasets.sh".

Does one still need to run "purge_datasets.sh" if used "-r" with 
"delete_datasets.sh" ?


4. If I accidentally run "purge_datasets.sh" without "-r" = is there a way to 
delete the stale files ?
 if not, perhaps the script should require either "-i" or "-r" to avoid such 
cases (or provide another cleanup script?)


comments are welcomed,
 -gordon


--- /localdata1/gordon/tmp/galaxy-central/scripts/cleanup_datasets/cleanup_datasets.py	2011-07-01 16:35:22.128341199 -0400
+++ ./scripts/cleanup_datasets/cleanup_datasets.py	2011-07-01 17:04:44.004707711 -0400
@@ -411,10 +411,13 @@ def _delete_dataset( dataset, app, remov
                 app.sa_session.add( metadata_file )
                 app.sa_session.flush()
             print "%s" % metadata_file.file_name
-        print "Deleting dataset id", dataset.id
-        dataset.deleted = True
-        app.sa_session.add( dataset )
-        app.sa_session.flush()
+	 if not info_only:
+            print "Deleting dataset id", dataset.id
+            dataset.deleted = True
+            app.sa_session.add( dataset )
+            app.sa_session.flush()
+        else:
+            print "Dataset %i will be deleted (without 'info_only' mode)" % ( dataset.id )
 
 def _purge_dataset( app, dataset, remove_from_disk, info_only = False ):
     if dataset.deleted:
@@ -433,6 +436,8 @@ def _purge_dataset( app, dataset, remove
                     dataset.purged = True
                     app.sa_session.add( dataset )
                     app.sa_session.flush()
+                else:
+                    print "Dataset %i will be purged (without 'info_only' mode)" % (dataset.id)
             else:
                 print "This dataset (%i) is not purgable, the file (%s) will not be removed.\n" % ( dataset.id, dataset.file_name )
         except OSError, exc:
___________________________________________________________
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:

  http://lists.bx.psu.edu/

Reply via email to