1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f8bebd9e12f5/
Changeset: f8bebd9e12f5
User: greg
Date: 2013-11-20 21:24:14
Summary: Display the "Skip automated testing" checkbox on repositories of type tool_dependency_definition in the tool shed.
Affected #: 1 file
diff -r 3d8ecec9515505f276fdaaa54c2f1af1c1d390b4 -r f8bebd9e12f53fca874739df55a34b73be224c0b templates/webapps/tool_shed/repository/manage_repository.mako
--- a/templates/webapps/tool_shed/repository/manage_repository.mako
+++ b/templates/webapps/tool_shed/repository/manage_repository.mako
@@ -7,6 +7,7 @@
<%
from galaxy.web.framework.helpers import time_ago
from tool_shed.util.shed_util_common import changeset_is_malicious
+ from tool_shed.repository_types.util import TOOL_DEPENDENCY_DEFINITION
if repository.metadata_revisions:
has_metadata = True
@@ -199,17 +200,25 @@
</div></div>
${render_repository_items( metadata, containers_dict, can_set_metadata=True, render_repository_actions_for='tool_shed' )}
-%if includes_tools:
+%if includes_tools or repository.type == TOOL_DEPENDENCY_DEFINITION:
<p/><div class="toolForm"><div class="toolFormTitle">Automated tool tests</div><div class="toolFormBody"><form name="skip_tool_tests" id="skip_tool_tests" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository_metadata.changeset_revision )}" method="post" ><div class="form-row">
- <label>Skip automated testing of tools in this revision:</label>
+ %if repository.type == TOOL_DEPENDENCY_DEFINITION:
+ <label>Skip automated testing of this tool dependency recipe</label>
+ %else:
+ <label>Skip automated testing of tools in this revision:</label>
+ %endif
${skip_tool_tests_check_box.get_html()}
<div class="toolParamHelp" style="clear: both;">
- Check the box and click <b>Save</b> to skip automated testing of the tools in this revision.
+ %if repository.type == TOOL_DEPENDENCY_DEFINITION:
+ Check the box and click <b>Save</b> to skip automated testing of this tool dependency recipe.
+ %else:
+ Check the box and click <b>Save</b> to skip automated testing of the tools in this revision.
+ %endif
</div></div><div style="clear: both"></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 commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3d8ecec95155/
Changeset: 3d8ecec95155
User: greg
Date: 2013-11-20 19:20:14
Summary: Enhance the tool shed repository's tool test inspection components to categorize empty <tests> or <test> tag sets defined in tool configs as "tool missing tests" instead of testing the tools with resulting test failures.
Affected #: 1 file
diff -r ec6c12a576850401bc502af2aa679a6c18568219 -r 3d8ecec9515505f276fdaaa54c2f1af1c1d390b4 lib/tool_shed/scripts/check_repositories_for_functional_tests.py
--- a/lib/tool_shed/scripts/check_repositories_for_functional_tests.py
+++ b/lib/tool_shed/scripts/check_repositories_for_functional_tests.py
@@ -284,18 +284,38 @@
# If there are no tests, this tool should not be tested, since the tool functional tests only report failure if the test itself fails,
# not if it's missing or undefined. Filtering out those repositories at this step will reduce the number of "false negatives" the
# automated functional test framework produces.
- tool_has_tests = True
- if 'tests' not in tool_metadata or not tool_metadata[ 'tests' ]:
- tool_has_tests = False
- if verbosity >= 2:
- print '# No functional tests defined for %s.' % tool_id
- no_tests += 1
- else:
- tool_has_tests = True
+ tool_has_tests = False
+ defined_test_dicts = tool_metadata.get( 'tests', None )
+ if defined_test_dicts is not None:
+ # We need to inspect the <test> tags because the following tags...
+ # <tests>
+ # </tests>
+ # ...will produce the following metadata:
+ # "tests": []
+ # And the following tags...
+ # <tests>
+ # <test>
+ # </test>
+ # </tests>
+ # ...will produce the following metadata:
+ # "tests":
+ # [{"inputs": [], "name": "Test-1", "outputs": [], "required_files": []}]
+ for defined_test_dict in defined_test_dicts:
+ inputs = defined_test_dict.get( 'inputs', [] )
+ outputs = defined_test_dict.get( 'outputs', [] )
+ if inputs and outputs:
+ # At least one tool within the repository has a valid <test> tag.
+ tool_has_tests = True
+ break
+ if tool_has_tests:
if verbosity >= 2:
print "# Tool ID '%s' in changeset revision %s of %s has one or more valid functional tests defined." % \
( tool_id, changeset_revision, name )
has_tests += 1
+ else:
+ if verbosity >= 2:
+ print '# No functional tests defined for %s.' % tool_id
+ no_tests += 1
failure_reason = ''
problem_found = False
missing_test_files = []
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 commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ec6c12a57685/
Changeset: ec6c12a57685
User: carlfeberhard
Date: 2013-11-20 17:25:41
Summary: HDA UI: remove visualizations button for anon users, fix tooltip/popup when only one visualization is found
Affected #: 2 files
diff -r df7d45db5d2b284528ba9ca4a02ba10c953453a0 -r ec6c12a576850401bc502af2aa679a6c18568219 static/scripts/mvc/dataset/hda-edit.js
--- a/static/scripts/mvc/dataset/hda-edit.js
+++ b/static/scripts/mvc/dataset/hda-edit.js
@@ -156,7 +156,8 @@
*/
_render_visualizationsButton : function(){
var visualizations = this.model.get( 'visualizations' );
- if( ( !this.model.hasData() )
+ if( ( !this.hasUser )
+ || ( !this.model.hasData() )
|| ( _.isEmpty( visualizations ) ) ){
return null;
}
@@ -209,8 +210,8 @@
}
// No need for popup menu because there's a single visualization.
- if ( visualizations.length === 1 ) {
- $icon.attr( 'title', visualizations[0] );
+ if( visualizations.length === 1 ){
+ $icon.attr( 'data-original-title', visualizations[0] );
$icon.click( create_viz_action( visualizations[0] ) );
// >1: Populate menu dict with visualization fns, make the popupmenu
diff -r df7d45db5d2b284528ba9ca4a02ba10c953453a0 -r ec6c12a576850401bc502af2aa679a6c18568219 static/scripts/packed/mvc/dataset/hda-edit.js
--- a/static/scripts/packed/mvc/dataset/hda-edit.js
+++ b/static/scripts/packed/mvc/dataset/hda-edit.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_render_titleButtons:function(){return a.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:"galaxy_main",classes:"dataset-edit"};if(g||i){h.disabled=true;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=_l("This dataset must finish uploading before it can be edited")}}h.faIcon="fa-pencil";return faIconButton(h)},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var g=this,h={title:_l("Delete"),classes:"dataset-delete",onclick:function(){g.$el.find(".icon-btn.dataset-delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){h={title:_l("Dataset is already deleted"),disabled:true}}h.faIcon="fa-times";return faIconButton(h)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,target:"galaxy_main",faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,target:"galaxy_main",faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.model.hasData())||(_.isEmpty(g))){return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}var h=faIconButton({title:_l("Visualize"),href:this.urls.visualization,faIcon:"fa-bar-chart-o"});function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){return null}var i=faIconButton({title:_l("Visualize"),faIcon:"fa-bar-chart-o"});i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_body_failed_metadata:function(){var h=$("<a/>").attr({href:this.urls.edit,target:"galaxy_main"}).text(_l("set it manually or retry auto-detection")),g=$("<span/>").text(". "+_l("You may be able to")+" ").append(h),i=a.HDABaseView.prototype._render_body_failed_metadata.call(this);i.find(".warningmessagesmall strong").append(g);return i},_render_body_error:function(){var g=a.HDABaseView.prototype._render_body_error.call(this);g.find(".dataset-actions .left").prepend(this._render_errButton());return g},_render_body_ok:function(){var g=a.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return g}this.makeDbkeyEditLink(g);if(this.hasUser){g.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(g);this._renderAnnotation(g)}return g},_renderTags:function(g){this.tagsEditor=new TagsEditor({model:this.model,el:g.find(".tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".dataset-actions .right"))})},_renderAnnotation:function(g){this.annotationEditor=new AnnotationEditor({model:this.model,el:g.find(".annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".dataset-actions .right"))})},makeDbkeyEditLink:function(g){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){g.find(".dataset-dbkey .value").replaceWith($('<a target="galaxy_main">?</a>').attr("href",this.urls.edit))}},events:_.extend(_.clone(a.HDABaseView.prototype.events),{"click .dataset-undelete":function(g){this.model.undelete();return false},"click .dataset-unhide":function(g){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function c(g){this.model.purge();return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});function e(g,h){action=function(){Galaxy.frame.add({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),target:"galaxy_main",scratchbook:true});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame.add({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i),scratchbook:true})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame.add({title:"Trackster",type:"url",content:m,scratchbook:true})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
+define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_render_titleButtons:function(){return a.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:"galaxy_main",classes:"dataset-edit"};if(g||i){h.disabled=true;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=_l("This dataset must finish uploading before it can be edited")}}h.faIcon="fa-pencil";return faIconButton(h)},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var g=this,h={title:_l("Delete"),classes:"dataset-delete",onclick:function(){g.$el.find(".icon-btn.dataset-delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){h={title:_l("Dataset is already deleted"),disabled:true}}h.faIcon="fa-times";return faIconButton(h)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,target:"galaxy_main",faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,target:"galaxy_main",faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(g))){return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}var h=faIconButton({title:_l("Visualize"),href:this.urls.visualization,faIcon:"fa-bar-chart-o"});function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("data-original-title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){return null}var i=faIconButton({title:_l("Visualize"),faIcon:"fa-bar-chart-o"});i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_body_failed_metadata:function(){var h=$("<a/>").attr({href:this.urls.edit,target:"galaxy_main"}).text(_l("set it manually or retry auto-detection")),g=$("<span/>").text(". "+_l("You may be able to")+" ").append(h),i=a.HDABaseView.prototype._render_body_failed_metadata.call(this);i.find(".warningmessagesmall strong").append(g);return i},_render_body_error:function(){var g=a.HDABaseView.prototype._render_body_error.call(this);g.find(".dataset-actions .left").prepend(this._render_errButton());return g},_render_body_ok:function(){var g=a.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return g}this.makeDbkeyEditLink(g);if(this.hasUser){g.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(g);this._renderAnnotation(g)}return g},_renderTags:function(g){this.tagsEditor=new TagsEditor({model:this.model,el:g.find(".tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".dataset-actions .right"))})},_renderAnnotation:function(g){this.annotationEditor=new AnnotationEditor({model:this.model,el:g.find(".annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".dataset-actions .right"))})},makeDbkeyEditLink:function(g){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){g.find(".dataset-dbkey .value").replaceWith($('<a target="galaxy_main">?</a>').attr("href",this.urls.edit))}},events:_.extend(_.clone(a.HDABaseView.prototype.events),{"click .dataset-undelete":function(g){this.model.undelete();return false},"click .dataset-unhide":function(g){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function c(g){this.model.purge();return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});function e(g,h){action=function(){Galaxy.frame.add({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),target:"galaxy_main",scratchbook:true});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame.add({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i),scratchbook:true})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame.add({title:"Trackster",type:"url",content:m,scratchbook:true})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
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 commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/30a9490f9bf6/
Changeset: 30a9490f9bf6
User: guerler
Date: 2013-11-20 04:55:20
Summary: Upload: Modify selection rule
Affected #: 1 file
diff -r b042f0fac1abe5bace4ae32e93595a453b99d9de -r 30a9490f9bf6ce4a18f8a7e7974f5e70651c7ba6 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -174,8 +174,9 @@
items.each(function()
{
var symbol = $(this).find('#symbol');
- if(symbol.hasClass(self.state.init)) {
- $(this).find('#genome').val(selected_genome);
+ var genome = $(this).find('#genome');
+ if(symbol.hasClass(self.state.init) && genome.val() == '?') {
+ genome.val(selected_genome);
}
});
});
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 commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d0ac928b3c1d/
Changeset: d0ac928b3c1d
User: Dave Bouvier
Date: 2013-11-19 22:37:11
Summary: Script to check the contents of an S3 bucket for tool dependency installation paths that have no contents, or that contain only the installation log. Optionally delete any found paths.
Affected #: 1 file
diff -r 5b91b8e9e71b037478dd76b105f34a775b7279dc -r d0ac928b3c1d529e32793a0fc27710e4a1585346 lib/tool_shed/scripts/check_s3_for_empty_tool_dependency_installation_paths.py
--- /dev/null
+++ b/lib/tool_shed/scripts/check_s3_for_empty_tool_dependency_installation_paths.py
@@ -0,0 +1,155 @@
+import argparse
+import os
+import sys
+
+new_path = [ os.path.join( os.getcwd(), "lib" ) ]
+new_path.extend( sys.path[1:] )
+sys.path = new_path
+
+from galaxy.util import asbool
+from galaxy import eggs
+eggs.require( 'boto' )
+
+import boto
+
+from tool_shed.galaxy_install.tool_dependencies.fabric_util import INSTALLATION_LOG
+
+
+class BucketList( object ):
+
+ def __init__( self, amazon_id, amazon_secret, bucket ):
+ # Connect to S3 using the provided Amazon access key and secret identifier.
+ self.s3 = boto.connect_s3( amazon_id, amazon_secret )
+ self.bucket_name = bucket
+ # Connect to S3 using the received bucket name.
+ self.bucket = boto.s3.bucket.Bucket( self.s3, bucket )
+ self.install_dirs = self.get_tool_dependency_install_paths()
+ self.empty_installation_paths = self.check_for_empty_tool_dependency_installation_paths()
+
+ def display_empty_installation_paths( self ):
+ for empty_installation_path in self.empty_installation_paths:
+ print empty_installation_path
+
+ def delete_empty_installation_paths( self ):
+ print 'Deleting empty installation paths.'
+ for empty_installation_path in self.empty_installation_paths:
+ # Get all keys in the S3 bucket that start with the installation path, and delete each one.
+ for path_to_delete in self.bucket.list( prefix=empty_installation_path ):
+ self.bucket.delete_key( path_to_delete.key )
+ print 'Deleted empty path %s' % str( empty_installation_path )
+
+ def get_tool_dependency_install_paths( self ):
+ found_paths = []
+ for item in self.bucket.list():
+ name = str( item.name )
+ # Skip environment_settings and __virtualenv_src, since these directories do not contain package tool dependencies.
+ if name.startswith( 'environment_settings' ) or name.startswith( '__virtualenv_src' ):
+ continue
+ paths = name.rstrip('/').split( '/' )
+ # Paths are in the format name/version/owner/repository/changeset_revision. If the changeset revision is
+ # present, we need to check the contents of that path. If not, then the tool dependency was completely
+ # uninstalled.
+ if len( paths ) >= 5:
+ td_install_dir = '/'.join( paths[ :5 ] ) + '/'
+ if td_install_dir not in found_paths:
+ found_paths.append( name )
+ return found_paths
+
+ def check_for_empty_tool_dependency_installation_paths( self ):
+ empty_directories = []
+ for item in self.install_dirs:
+ # Get all entries under the path for this tool dependency.
+ contents = self.bucket.list( prefix=item )
+ tool_dependency_path_contents = []
+ # Find out if there are two or less items in the path. The first entry will be the installation path itself.
+ # If only one other item exists, and the full path ends with the installation log, this is an incorrectly installed
+ # tool dependency.
+ for item in contents:
+ tool_dependency_path_contents.append( item )
+ # If there are more than two items in the path, we cannot safely assume that the dependency failed to
+ # install correctly.
+ if len( tool_dependency_path_contents ) > 2:
+ break
+ # If the root directory is the only entry in the path, we have an empty tool dependency installation path.
+ if len( tool_dependency_path_contents ) == 1:
+ empty_directories.append( tool_dependency_path_contents[ 0 ] )
+ # Otherwise, if the only other entry is the installation log, we have an installation path that should be deleted.
+ # This would not be the case in a Galaxy instance, since the Galaxy admin will need to verify the contents of
+ # the installation path in order to determine which action should be taken.
+ elif len( tool_dependency_path_contents ) == 2 and tool_dependency_path_contents[1].name.endswith( INSTALLATION_LOG ):
+ empty_directories.append( tool_dependency_path_contents[ 0 ] )
+ return [ item.name for item in empty_directories ]
+
+def main( args ):
+ '''
+ Amazon credentials can be provided in one of three ways:
+ 1. By specifying them on the command line with the --id and --secret arguments.
+ 2. By specifying a path to a file that contains the credentials in the form ACCESS_KEY:SECRET_KEY
+ using the --s3passwd argument.
+ 3. By specifying the above path in the 's3passwd' environment variable.
+ Each listed option will override the ones below it, if present.
+ '''
+ if None in [ args.id, args.secret ]:
+ if args.s3passwd is None:
+ args.s3passwd = os.environ.get( 's3passwd', None )
+ if args.s3passwd is not None and os.path.exists( args.s3passwd ):
+ awsid, secret = file( args.s3passwd, 'r' ).read().rstrip( '\n' ).split( ':' )
+ else:
+ print 'Amazon ID and secret not provided, and no s3passwd file found.'
+ return 1
+ else:
+ awsid = args.id
+ secret = args.secret
+ dependency_cleaner = BucketList( awsid, secret, args.bucket )
+ if len( dependency_cleaner.empty_installation_paths ) == 0:
+ print 'No empty installation paths found, exiting.'
+ return 0
+ print 'The following %d tool dependency installation paths were found to be empty or contain only the file %s.' % \
+ ( len( dependency_cleaner.empty_installation_paths ), INSTALLATION_LOG )
+ if asbool( args.delete ):
+ dependency_cleaner.delete_empty_installation_paths()
+ else:
+ for empty_installation_path in dependency_cleaner.empty_installation_paths:
+ print empty_installation_path
+ return 0
+
+if __name__ == '__main__':
+ description = 'Determine if there are any tool dependency installation paths that should be removed. Remove them if '
+ description += 'the --delete command line argument is provided with a true value.'
+ parser = argparse.ArgumentParser( description=description )
+ parser.add_argument( '--delete',
+ dest='delete',
+ required=True,
+ action='store',
+ default=False,
+ type=asbool,
+ help='Whether to delete empty folders or list them on exit.' )
+ parser.add_argument( '--bucket',
+ dest='bucket',
+ required=True,
+ action='store',
+ metavar='name',
+ help='The S3 bucket where tool dependencies are installed.' )
+ parser.add_argument( '--id',
+ dest='id',
+ required=False,
+ action='store',
+ default=None,
+ metavar='ACCESS_KEY',
+ help='The identifier for an amazon account that has read access to the bucket.' )
+ parser.add_argument( '--secret',
+ dest='secret',
+ required=False,
+ action='store',
+ default=None,
+ metavar='SECRET_KEY',
+ help='The secret key for an amazon account that has upload/delete access to the bucket.' )
+ parser.add_argument( '--s3passwd',
+ dest='s3passwd',
+ required=False,
+ action='store',
+ default=None,
+ metavar='path/file',
+ help='The path to a file containing Amazon access credentials, in the format KEY:SECRET.' )
+ args = parser.parse_args()
+ sys.exit( main( args ) )
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.