1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/9d17faf3398a/
changeset: 9d17faf3398a
user: greg
date: 2011-07-19 21:10:11
summary: Fix for message display when setting tool shed repository metadata.
affected #: 1 file (64 bytes)
--- a/lib/galaxy/webapps/community/controllers/common.py Tue Jul 19 13:48:42 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Jul 19 15:10:11 2011 -0400
@@ -230,6 +230,8 @@
correction_msg += "Upload a file named <b>%s</b> to the repository to correct this error." % sample_loc_file
else:
correction_msg += "Upload a file named <b>%s</b> to the repository to correct this error." % missing_file
+ else:
+ correction_msg = exception_msg
message += "<b>%s</b> - %s<br/>" % ( tool_file, correction_msg )
status = 'error'
elif flush_needed:
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.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/f9ef2aecaecd/
changeset: f9ef2aecaecd
user: greg
date: 2011-07-19 19:48:42
summary: Add exception handling around all mercurial api commit calls. On Linux, the mercurial api's commit seems to bump into issues intermittently, throws an exception, and rolls back the transaction. Although I can reproduce it on Linux, I cannot produce this behavior on a Mac. The exception handler uses a different approach to committing the changes. I've also added this code to the update_for_browsing method.
affected #: 3 files (1.9 KB)
--- a/lib/galaxy/webapps/community/controllers/common.py Tue Jul 19 11:27:16 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Jul 19 13:48:42 2011 -0400
@@ -297,7 +297,7 @@
util.send_mail( frm, to, subject, body, trans.app.config )
except Exception, e:
log.exception( "An error occurred sending a tool shed repository update alert by email." )
-def update_for_browsing( repository, current_working_dir ):
+def update_for_browsing( repository, current_working_dir, commit_message='' ):
# Make a copy of a repository's files for browsing.
repo_dir = repository.repo_path
repo = hg.repository( ui.ui(), repo_dir )
@@ -316,12 +316,15 @@
# ! = deleted, but still tracked
# ? = not tracked
# I = ignored
- # We'll remove all files that are not tracked or ignored.
files_to_remove_from_disk = []
+ files_to_commit = []
for status_and_file_name in status_and_file_names:
if status_and_file_name.startswith( '?' ) or status_and_file_name.startswith( 'I' ):
files_to_remove_from_disk.append( os.path.abspath( os.path.join( repo_dir, status_and_file_name.split()[1] ) ) )
+ elif status_and_file_name.startswith( 'M' ) or status_and_file_name.startswith( 'A' ) or status_and_file_name.startswith( 'R' ):
+ files_to_commit.append( os.path.abspath( os.path.join( repo_dir, status_and_file_name.split()[1] ) ) )
for full_path in files_to_remove_from_disk:
+ # We'll remove all files that are not tracked or ignored.
if os.path.isdir( full_path ):
try:
os.rmdir( full_path )
@@ -336,6 +339,11 @@
except OSError, e:
# The directory is not empty
pass
+ if files_to_commit:
+ if not commit_message:
+ commit_message = 'Committed changes to: %s' % ', '.join( files_to_commit )
+ repo.dirstate.write()
+ repo.commit( text=commit_message )
os.chdir( repo_dir )
os.system( 'hg update > /dev/null 2>&1' )
os.chdir( current_working_dir )
--- a/lib/galaxy/webapps/community/controllers/repository.py Tue Jul 19 11:27:16 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Jul 19 13:48:42 2011 -0400
@@ -425,7 +425,7 @@
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
current_working_dir = os.getcwd()
- update_for_browsing( repository, current_working_dir )
+ update_for_browsing( repository, current_working_dir, commit_message=commit_message )
return trans.fill_template( '/webapps/community/repository/browse_repository.mako',
repo=repo,
repository=repository,
@@ -454,11 +454,17 @@
# Commit the change set.
if not commit_message:
commit_message = 'Deleted selected files'
- # Commit the changes.
- commands.commit( repo.ui, repo, repo_dir, user=trans.user.username, message=commit_message )
+ try:
+ commands.commit( repo.ui, repo, repo_dir, user=trans.user.username, message=commit_message )
+ except Exception, e:
+ # I never have a problem with commands.commit on a Mac, but in the test/production
+ # tool shed environment, it occasionally throws a "TypeError: array item must be char"
+ # exception. If this happens, we'll try the following.
+ repo.dirstate.write()
+ repo.commit( text=commit_message )
handle_email_alerts( trans, repository )
# Update the repository files for browsing.
- update_for_browsing( repository, current_working_dir )
+ update_for_browsing( repository, current_working_dir, commit_message=commit_message )
# Get the new repository tip.
repo = hg.repository( ui.ui(), repo_dir )
if tip != repository.tip:
--- a/lib/galaxy/webapps/community/controllers/upload.py Tue Jul 19 11:27:16 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Jul 19 13:48:42 2011 -0400
@@ -87,7 +87,16 @@
# Move the uploaded file to the load_point within the repository hierarchy.
shutil.move( uploaded_file_name, full_path )
commands.add( repo.ui, repo, full_path )
- commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
+ """
+ try:
+ commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
+ except Exception, e:
+ # I never have a problem with commands.commit on a Mac, but in the test/production
+ # tool shed environment, it occasionally throws a "TypeError: array item must be char"
+ # exception. If this happens, we'll try the following.
+ repo.dirstate.write()
+ repo.commit( text=commit_message )
+ """
if full_path.endswith( '.loc.sample' ):
# Handle the special case where a xxx.loc.sample file is
# being uploaded by copying it to ~/tool-data/xxx.loc.
@@ -96,7 +105,7 @@
if ok:
# Update the repository files for browsing, a by-product of doing this
# is eliminating unwanted files from the repository directory.
- update_for_browsing( repository, current_working_dir )
+ update_for_browsing( repository, current_working_dir, commit_message=commit_message )
# Get the new repository tip.
if tip != repository.tip:
if ( isgzip or isbz2 ) and uncompress_file:
@@ -183,8 +192,14 @@
# Handle the special case where a xxx.loc.sample file is
# being uploaded by copying it to ~/tool-data/xxx.loc.
copy_sample_loc_file( trans, filename_in_archive )
- # Commit the changes.
- commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
+ try:
+ commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
+ except Exception, e:
+ # I never have a problem with commands.commit on a Mac, but in the test/production
+ # tool shed environment, it occasionally throws a "TypeError: array item must be char"
+ # exception. If this happens, we'll try the following.
+ repo.dirstate.write()
+ repo.commit( text=commit_message )
handle_email_alerts( trans, repository )
return True, '', files_to_remove
def uncompress( self, repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 ):
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.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/98ef4f135243/
changeset: 98ef4f135243
user: greg
date: 2011-07-19 17:27:16
summary: Various tool shed fixes and enhancements:
1) Fix for uploading empty files to a repository
2) Better error messages when setting repository metadata fails
3) Automatically copy uploaded xxx.loc.sample files to ~/tool-data/xxx.loc
4) Fix for setting the value of the upload_point when uploading files to a repository
affected #: 4 files (3.3 KB)
--- a/lib/galaxy/webapps/community/controllers/common.py Mon Jul 18 21:56:23 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Jul 19 11:27:16 2011 -0400
@@ -214,7 +214,23 @@
if invalid_files:
message = "Metadata cannot be defined for change set revision '%s'. Correct the following problems and reset metadata.<br/>" % str( change_set_revision )
for itc_tup in invalid_files:
- message += "<b>%s</b> - %s<br/>" % ( itc_tup[0], itc_tup[1] )
+ # Handle the special case where a tool depends on a missing xxx.loc file by telliing
+ # the user to upload xxx.loc.sample to the repository so that it can be copied to
+ # ~/tool-data/xxx.loc. In this case, itc_tup[1] will be a message looking something like:
+ # [Errno 2] No such file or directory: '/Users/gvk/central/tool-data/blast2go.loc'
+ tool_file = itc_tup[0]
+ exception_msg = itc_tup[1]
+ if exception_msg.find( 'No such file or directory' ) >= 0:
+ exception_items = exception_msg.split()
+ missing_file_items = exception_items[7].split( '/' )
+ missing_file = missing_file_items[-1].rstrip( '\'' )
+ correction_msg = "This file refers to a missing file <b>%s</b>. " % str( missing_file )
+ if exception_msg.find( '.loc' ) >= 0:
+ sample_loc_file = '%s.sample' % str( missing_file )
+ correction_msg += "Upload a file named <b>%s</b> to the repository to correct this error." % sample_loc_file
+ else:
+ correction_msg += "Upload a file named <b>%s</b> to the repository to correct this error." % missing_file
+ message += "<b>%s</b> - %s<br/>" % ( tool_file, correction_msg )
status = 'error'
elif flush_needed:
# We only flush if there are no tool config errors, so change sets will only have metadata
@@ -231,6 +247,14 @@
if str( ctx ) == change_set_revision:
return ctx
return None
+def copy_sample_loc_file( trans, filename ):
+ """Copy xxx.loc.sample to ~/tool-data/xxx.loc"""
+ sample_loc_file = os.path.split( filename )[1]
+ loc_file = os.path.split( filename )[1].rstrip( '.sample' )
+ tool_data_path = os.path.abspath( trans.app.config.tool_data_path )
+ if not ( os.path.exists( os.path.join( tool_data_path, loc_file ) ) or os.path.exists( os.path.join( tool_data_path, sample_loc_file ) ) ):
+ shutil.copy( os.path.abspath( filename ), os.path.join( tool_data_path, sample_loc_file ) )
+ shutil.copy( os.path.abspath( filename ), os.path.join( tool_data_path, loc_file ) )
def get_user( trans, id ):
"""Get a user from the database"""
return trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( id ) )
--- a/lib/galaxy/webapps/community/controllers/upload.py Mon Jul 18 21:56:23 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Jul 19 11:27:16 2011 -0400
@@ -45,6 +45,7 @@
uploaded_file = file_data.file
uploaded_file_name = uploaded_file.name
uploaded_file_filename = file_data.filename
+ isempty = os.path.getsize( os.path.abspath( uploaded_file_name ) ) == 0
if uploaded_file:
isgzip = False
isbz2 = False
@@ -53,17 +54,21 @@
if not isgzip:
isbz2 = is_bz2( uploaded_file_name )
ok = True
- # Determine what we have - a single file or an archive
- try:
- if ( isgzip or isbz2 ) and uncompress_file:
- # Open for reading with transparent compression.
- tar = tarfile.open( uploaded_file_name, 'r:*' )
- else:
- tar = tarfile.open( uploaded_file_name )
- istar = True
- except tarfile.ReadError, e:
+ if isempty:
tar = None
istar = False
+ else:
+ # Determine what we have - a single file or an archive
+ try:
+ if ( isgzip or isbz2 ) and uncompress_file:
+ # Open for reading with transparent compression.
+ tar = tarfile.open( uploaded_file_name, 'r:*' )
+ else:
+ tar = tarfile.open( uploaded_file_name )
+ istar = True
+ except tarfile.ReadError, e:
+ tar = None
+ istar = False
if istar:
ok, message, files_to_remove = self.upload_tar( trans,
repository,
@@ -83,6 +88,10 @@
shutil.move( uploaded_file_name, full_path )
commands.add( repo.ui, repo, full_path )
commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
+ if full_path.endswith( '.loc.sample' ):
+ # Handle the special case where a xxx.loc.sample file is
+ # being uploaded by copying it to ~/tool-data/xxx.loc.
+ copy_sample_loc_file( trans, full_path )
handle_email_alerts( trans, repository )
if ok:
# Update the repository files for browsing, a by-product of doing this
@@ -170,6 +179,10 @@
commands.remove( repo.ui, repo, repo_file )
for filename_in_archive in filenames_in_archive:
commands.add( repo.ui, repo, filename_in_archive )
+ if filename_in_archive.endswith( '.loc.sample' ):
+ # Handle the special case where a xxx.loc.sample file is
+ # being uploaded by copying it to ~/tool-data/xxx.loc.
+ copy_sample_loc_file( trans, filename_in_archive )
# Commit the changes.
commands.commit( repo.ui, repo, full_path, user=trans.user.username, message=commit_message )
handle_email_alerts( trans, repository )
--- a/templates/webapps/community/repository/common.mako Mon Jul 18 21:56:23 2011 -0400
+++ b/templates/webapps/community/repository/common.mako Tue Jul 19 11:27:16 2011 -0400
@@ -44,7 +44,7 @@
}
// The following is used only in ~/templates/webapps/community/repository/upload.mako.
if (document.forms["upload_form"]) {
- document.upload_form.upload_point.value = selKeys[0];
+ document.upload_form.upload_point.value = selKeys.slice(-1);
}
},
onActivate: function(dtnode) {
--- a/templates/webapps/community/repository/upload.mako Mon Jul 18 21:56:23 2011 -0400
+++ b/templates/webapps/community/repository/upload.mako Tue Jul 19 11:27:16 2011 -0400
@@ -64,96 +64,96 @@
<div class="toolForm"><div class="toolFormTitle">Upload a single file or a tarball</div><div class="toolFormBody">
- ## TODO: nginx
- <form id="upload_form" name="upload_form" action="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}" enctype="multipart/form-data" method="post">
- <div class="form-row">
- <label>File:</label>
- <div class="form-row-input">
- <input type="file" name="file_data"/>
- </div>
- <div style="clear: both"></div>
- </div>
-
- <div class="form-row">
- <%
- if uncompress_file:
- yes_selected = 'selected'
- no_selected = ''
- else:
- yes_selected = ''
- no_selected = 'selected'
- %>
- <label>Uncompress files?</label>
- <div class="form-row-input">
- <select name="uncompress_file">
- <option value="true" ${yes_selected}>Yes
- <option value="false" ${no_selected}>No
- </select>
- </div>
- <div class="toolParamHelp" style="clear: both;">
- Supported compression types are gz and bz2. If <b>Yes</b> is selected, the uploaded file will be uncompressed. However,
- if the uploaded file is an archive that contains compressed files, the contained files will not be uncompressed. For
- example, if the uploaded compressed file is some_file.tar.gz, some_file.tar will be uncompressed and extracted, but if
- some_file.tar contains some_contained_file.gz, the contained file will not be uncompressed.
- </div>
- </div>
- %if not is_new:
- <div class="form-row">
- <%
- if remove_repo_files_not_in_tar:
- yes_selected = 'selected'
- no_selected = ''
- else:
- yes_selected = ''
- no_selected = 'selected'
- %>
- <label>Remove files in the repository (relative to the root or selected upload point) that are not in the uploaded archive?</label>
- <div class="form-row-input">
- <select name="remove_repo_files_not_in_tar">
- <option value="true" ${yes_selected}>Yes
- <option value="false" ${no_selected}>No
- </select>
+ ## TODO: nginx
+ <form id="upload_form" name="upload_form" action="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}" enctype="multipart/form-data" method="post">
+ <div class="form-row">
+ <label>File:</label>
+ <div class="form-row-input">
+ <input type="file" name="file_data"/>
+ </div>
+ <div style="clear: both"></div></div>
- <div class="toolParamHelp" style="clear: both;">
- This selection pertains only to uploaded tar archives, not to single file uploads. If <b>Yes</b> is selected, files
- that exist in the repository (relative to the root or selected upload point) but that are not in the uploaded archive
- will be removed from the repository. Otherwise, all existing repository files will remain and the uploaded archive
- files will be added to the repository.
+
+ <div class="form-row">
+ <%
+ if uncompress_file:
+ yes_selected = 'selected'
+ no_selected = ''
+ else:
+ yes_selected = ''
+ no_selected = 'selected'
+ %>
+ <label>Uncompress files?</label>
+ <div class="form-row-input">
+ <select name="uncompress_file">
+ <option value="true" ${yes_selected}>Yes
+ <option value="false" ${no_selected}>No
+ </select>
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ Supported compression types are gz and bz2. If <b>Yes</b> is selected, the uploaded file will be uncompressed. However,
+ if the uploaded file is an archive that contains compressed files, the contained files will not be uncompressed. For
+ example, if the uploaded compressed file is some_file.tar.gz, some_file.tar will be uncompressed and extracted, but if
+ some_file.tar contains some_contained_file.gz, the contained file will not be uncompressed.
+ </div></div>
- </div>
- %endif
- <div class="form-row">
- <label>Change set commit message:</label>
- <div class="form-row-input">
- %if commit_message:
- <pre><textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea></pre>
- %else:
- <textarea name="commit_message" rows="3" cols="35"></textarea>
+ %if not is_new:
+ <div class="form-row">
+ <%
+ if remove_repo_files_not_in_tar:
+ yes_selected = 'selected'
+ no_selected = ''
+ else:
+ yes_selected = ''
+ no_selected = 'selected'
+ %>
+ <label>Remove files in the repository (relative to the root or selected upload point) that are not in the uploaded archive?</label>
+ <div class="form-row-input">
+ <select name="remove_repo_files_not_in_tar">
+ <option value="true" ${yes_selected}>Yes
+ <option value="false" ${no_selected}>No
+ </select>
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ This selection pertains only to uploaded tar archives, not to single file uploads. If <b>Yes</b> is selected, files
+ that exist in the repository (relative to the root or selected upload point) but that are not in the uploaded archive
+ will be removed from the repository. Otherwise, all existing repository files will remain and the uploaded archive
+ files will be added to the repository.
+ </div>
+ </div>
%endif
- </div>
- <div class="toolParamHelp" style="clear: both;">
- This is the commit message for the mercurial change set that will be created by this upload.
- </div>
- <div style="clear: both"></div>
- </div>
- %if not repository.is_new:
- <div class="form-row" >
- <label>Contents:</label>
- <div id="tree" >
- Loading...
+ <div class="form-row">
+ <label>Change set commit message:</label>
+ <div class="form-row-input">
+ %if commit_message:
+ <pre><textarea name="commit_message" rows="3" cols="35">${commit_message}</textarea></pre>
+ %else:
+ <textarea name="commit_message" rows="3" cols="35"></textarea>
+ %endif
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ This is the commit message for the mercurial change set that will be created by this upload.
+ </div>
+ <div style="clear: both"></div></div>
- <input type="hidden" id="upload_point" name="upload_point" value=""/>
- <div class="toolParamHelp" style="clear: both;">
- Select a location within the repository to upload your files by clicking a check box next to the location. The
- selected location is considered the upload point. If a location is not selected, the upload point will be the
- repository root.
+ %if not repository.is_new:
+ <div class="form-row" >
+ <label>Contents:</label>
+ <div id="tree" >
+ Loading...
+ </div>
+ <input type="hidden" id="upload_point" name="upload_point" value=""/>
+ <div class="toolParamHelp" style="clear: both;">
+ Select a location within the repository to upload your files by clicking a check box next to the location. The
+ selected location is considered the upload point. If a location is not selected, the upload point will be the
+ repository root.
+ </div>
+ <div style="clear: both"></div>
+ </div>
+ %endif
+ <div class="form-row">
+ <input type="submit" class="primary-button" name="upload_button" value="Upload"></div>
- <div style="clear: both"></div>
- </div>
- %endif
- <div class="form-row">
- <input type="submit" class="primary-button" name="upload_button" value="Upload">
- </div>
- </form>
+ </form></div></div>
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.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/8e05f9425723/
changeset: 8e05f9425723
user: dannon
date: 2011-07-18 21:02:37
summary: Case sensitivity note for login not found error.
affected #: 3 files (129 bytes)
--- a/lib/galaxy/web/controllers/mobile.py Mon Jul 18 15:09:49 2011 +0200
+++ b/lib/galaxy/web/controllers/mobile.py Mon Jul 18 15:02:37 2011 -0400
@@ -47,7 +47,7 @@
error = password_error = None
user = trans.sa_session.query( model.User ).filter_by( email = email ).first()
if not user:
- error = "No such user"
+ error = "No such user (please note that login is case sensitive)"
elif user.deleted:
error = "This account has been marked deleted, contact your Galaxy administrator to restore the account."
elif user.external:
--- a/lib/galaxy/web/controllers/user.py Mon Jul 18 15:09:49 2011 +0200
+++ b/lib/galaxy/web/controllers/user.py Mon Jul 18 15:02:37 2011 -0400
@@ -394,7 +394,7 @@
success = False
user = trans.sa_session.query( trans.app.model.User ).filter( trans.app.model.User.table.c.email==email ).first()
if not user:
- message = "No such user"
+ message = "No such user (please note that login is case sensitive)"
status = 'error'
elif user.deleted:
message = "This account has been marked deleted, contact your Galaxy administrator to restore the account."
--- a/scripts/check_galaxy.py Mon Jul 18 15:09:49 2011 +0200
+++ b/scripts/check_galaxy.py Mon Jul 18 15:02:37 2011 -0400
@@ -292,7 +292,7 @@
self.in_span = False
def handle_data(self, data):
if self.in_span:
- if data == "No such user":
+ if data == "No such user (please note that login is case sensitive)":
self.no_user = True
elif data == "Invalid password":
self.bad_pw = True
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.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/f2638528e904/
changeset: f2638528e904
user: jgoecks
date: 2011-07-14 22:54:43
summary: Fix bug in trackster filtering of GFF datasets.
affected #: 1 file (0 bytes)
--- a/lib/galaxy/visualization/tracks/data_providers.py Thu Jul 14 15:58:06 2011 -0400
+++ b/lib/galaxy/visualization/tracks/data_providers.py Thu Jul 14 22:54:43 2011 +0200
@@ -412,7 +412,7 @@
'type': 'int',
'index': filter_col,
'tool_id': 'Filter1',
- 'tool_exp_name': 'c5' } ]
+ 'tool_exp_name': 'c6' } ]
filter_col += 1
if isinstance( self.original_dataset.datatype, Gtf ):
# Create filters based on dataset metadata.
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.
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a3fc507f2b42/
changeset: a3fc507f2b42
user: greg
date: 2011-07-14 21:58:06
summary: Another patch from Assaf Gordon for the cleanup_datasets.py script.
This patch adds messages for the "purge histories" step:
1. A message is printed when processing a new history (so that the user can tell to which history the following dataset/hda messages belong).
2. in "info_only" mode, a message is printed about each deleted history
3. in "info_only" mode, a message is printed for each HDA that is checked
4. The message for HDA is changed to include the associated dataset id.
affected #: 1 file (784 bytes)
--- a/scripts/cleanup_datasets/cleanup_datasets.py Thu Jul 14 14:25:29 2011 -0400
+++ b/scripts/cleanup_datasets/cleanup_datasets.py Thu Jul 14 15:58:06 2011 -0400
@@ -170,6 +170,7 @@
app.model.History.table.c.update_time < cutoff_time ) ) \
.options( eagerload( 'datasets' ) )
for history in histories:
+ print "### Processing history id %d (%s)" % (history.id, history.name)
for dataset_assoc in history.datasets:
_purge_dataset_instance( dataset_assoc, app, remove_from_disk, info_only = info_only ) #mark a DatasetInstance as deleted, clear associated files, and mark the Dataset as deleted if it is deletable
if not info_only:
@@ -182,6 +183,8 @@
history.purged = True
app.sa_session.add( history )
app.sa_session.flush()
+ else:
+ print "History id %d will be purged (without 'info_only' mode)" % history.id
history_count += 1
stop = time.time()
print 'Purged %d histories.' % history_count
@@ -364,15 +367,24 @@
# A dataset_instance is either a HDA or an LDDA. Purging a dataset instance marks the instance as deleted,
# and marks the associated dataset as deleted if it is not associated with another active DatsetInstance.
if not info_only:
- print "Marking as deleted: ", dataset_instance.__class__.__name__, " id ", dataset_instance.id
+ print "Marking as deleted: %s id %d (for dataset id %d)" % \
+ ( dataset_instance.__class__.__name__, dataset_instance.id, dataset_instance.dataset.id )
dataset_instance.mark_deleted( include_children = include_children )
dataset_instance.clear_associated_files()
app.sa_session.add( dataset_instance )
app.sa_session.flush()
app.sa_session.refresh( dataset_instance.dataset )
+ else:
+ print "%s id %d (for dataset id %d) will be marked as deleted (without 'info_only' mode)" % \
+ ( dataset_instance.__class__.__name__, dataset_instance.id, dataset_instance.dataset.id )
if is_deletable or _dataset_is_deletable( dataset_instance.dataset ):
# Calling methods may have already checked _dataset_is_deletable, if so, is_deletable should be True
_delete_dataset( dataset_instance.dataset, app, remove_from_disk, info_only=info_only, is_deletable=is_deletable )
+ else:
+ if info_only:
+ print "Not deleting dataset ", dataset_instance.dataset.id, " (will be possibly deleted without 'info_only' mode)"
+ else:
+ print "Not deleting dataset %d (shared between multiple histories/libraries, at least one not deleted)" % dataset_instance.dataset.id
#need to purge children here
if include_children:
for child in dataset_instance.children:
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.