7 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/7666506937e2/ Changeset: 7666506937e2 Branch: tool-autoload User: kell...@gmail.com Date: 2014-09-25 22:24:31+00:00 Summary: Adding in the ability to configure a tool 'auto-load' directory. Affected #: 3 files diff -r 82f8d68414f5c9a0e5aeaaabca85cf7044e06183 -r 7666506937e21d70856474a9406f444799579349 config/galaxy.ini.sample --- a/config/galaxy.ini.sample +++ b/config/galaxy.ini.sample @@ -120,7 +120,7 @@ # tool shed install data. There are many situtations in which it is # valuable to seperate these - for instance bootstrapping fresh Galaxy # instances with pretested installs. The following optin can be used to -# separate the tool shed install database (all other options listed above +# separate the tool shed install database (all other options listed above # but prefixed with install_ are also available). #install_database_connection = sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE @@ -160,6 +160,14 @@ # Other tool config files must include the tool_path as an attribute in the <toolbox> tag. #tool_path = tools +# Path to autoload tools from. +# Every directory inside the autoload directory will be scanned for *.xml files +# and those will be loaded as tool descriptors +#tool_autoload_dir = ./tool-autoload + +# Autoload Panel, for all tools that are autoloaded, they are placed in this tool section +#tool_autoload_section = Development + # Path to the directory in which tool dependencies are placed. This is used by # the tool shed to install dependencies and can also be used by administrators # to manually install or link to dependencies. For details, see: @@ -173,7 +181,7 @@ #tool_sheds_config_file = config/tool_sheds_conf.xml # Enable automatic polling of relative tool sheds to see if any updates -# are available for installed repositories. Ideally only one Galaxy +# are available for installed repositories. Ideally only one Galaxy # server process should be able to check for repository updates. The # setting for hours_between_check should be an integer between 1 and 24. #enable_tool_shed_check = False @@ -238,7 +246,7 @@ #citation_cache_data_dir = database/citations/data #citation_cache_lock_dir = database/citations/lock -# External service types config file, defines what types of external_services configurations +# External service types config file, defines what types of external_services configurations # are available in Galaxy (.sample is used if default does not exist). #external_service_type_config_file = config/external_service_types_conf.xml @@ -347,15 +355,15 @@ # -- Account activation -# This is user account activation feature global flag. If set to "False" the rest of the Account +# This is user account activation feature global flag. If set to "False" the rest of the Account # activation configuration is ignored and user activation is disabled (a.k.a. accounts are active since registration). # Note the activation is also not working in case the smtp server is not defined. #user_activation_on = False -# Activation grace period. Activation is not forced (login is not disabled) until +# Activation grace period. Activation is not forced (login is not disabled) until # grace period has passed. Users under grace period can't run jobs (see inactivity_box_content). -# In hours. Default is 3. Enter 0 to disable grace period. -# Users with OpenID logins have grace period forever. +# In hours. Default is 3. Enter 0 to disable grace period. +# Users with OpenID logins have grace period forever. #activation_grace_period = 0 # Used for warning box for inactive accounts (unable to run jobs). @@ -415,7 +423,7 @@ # - $iso8601 (complete format string as specified by ISO 8601 international standard). # pretty_datetime_format = $locale (UTC) -# The URL of the page to display in Galaxy's middle pane when loaded. This can be +# The URL of the page to display in Galaxy's middle pane when loaded. This can be # an absolute or relative URL. #welcome_url = /static/welcome.html @@ -447,7 +455,7 @@ # The URL linked by the "Galaxy Q&A" link in the "Help" menu # The Galaxy Q&A site is under development; when the site is done, this URL # will be set and uncommented. -#qa_url = +#qa_url = # Serve static content, which must be enabled if you're not serving it via a # proxy server. These options should be self explanatory and so are not @@ -600,7 +608,7 @@ # if testing shows that Galaxy is able to create files using these formats. # Specific formats can be disabled with this option, separate more than one # format with commas. Available formats are currently 'zip', 'gz', and 'bz2'. -#disable_library_comptypes = +#disable_library_comptypes = # Some sequencer integration features in beta allow you to automatically # transfer datasets. This is done using a lightweight transfer manager which @@ -750,7 +758,7 @@ # File where Data Managers are configured (.sample used if default does not # exist) #data_manager_config_file = config/data_manager_conf.xml -# File where Tool Shed based Data Managers are configured +# File where Tool Shed based Data Managers are configured #shed_data_manager_config_file = config/shed_data_manager_conf.xml # Directory to store Data Manager based tool-data; defaults to tool_data_path #galaxy_data_manager_data_path = tool-data @@ -869,11 +877,11 @@ # ---- Galaxy External Message Queue ------------------------------------------------- -# Galaxy uses AMQ protocol to receive messages from external sources like +# Galaxy uses AMQ protocol to receive messages from external sources like # bar code scanners. Galaxy has been tested against RabbitMQ AMQP implementation. -# For Galaxy to receive messages from a message queue the RabbitMQ server has +# For Galaxy to receive messages from a message queue the RabbitMQ server has # to be set up with a user account and other parameters listed below. The 'host' -# and 'port' fields should point to where the RabbitMQ server is running. +# and 'port' fields should point to where the RabbitMQ server is running. [galaxy_amqp] @@ -886,4 +894,3 @@ #exchange = galaxy_exchange #routing_key = bar_code_scanner #rabbitmqctl_path = /path/to/rabbitmqctl - diff -r 82f8d68414f5c9a0e5aeaaabca85cf7044e06183 -r 7666506937e21d70856474a9406f444799579349 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -88,6 +88,9 @@ self.user_label_filters = listify( kwargs.get( "user_tool_label_filters", [] ), do_strip=True ) self.user_section_filters = listify( kwargs.get( "user_tool_section_filters", [] ), do_strip=True ) + self.tool_autoload_dir = kwargs.get( "tool_autoload_dir", None ) + self.tool_autoload_section = kwargs.get( "tool_autoload_section", None ) + # Check for tools defined in the above non-shed tool configs (i.e., tool_conf.xml) tht have # been migrated from the Galaxy code distribution to the Tool Shed. self.check_migrate_tools = string_as_bool( kwargs.get( 'check_migrate_tools', True ) ) diff -r 82f8d68414f5c9a0e5aeaaabca85cf7044e06183 -r 7666506937e21d70856474a9406f444799579349 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -157,6 +157,23 @@ self.init_tools( config_filename ) except: log.exception( "Error loading tools defined in config %s", config_filename ) + if self.app.config.tool_autoload_dir is not None: + log.info("Autoloading tool directory: %s" % (self.app.config.tool_autoload_dir)) + + auto_load_section = ToolSection({ + 'id' : "__tool_autoload__", + 'version' : "1.0.0", + 'name' : self.app.config.tool_autoload_section}) + + for tool_xml_path in glob.glob(os.path.join(self.app.config.tool_autoload_dir, "*", "*.xml")): + log.info("AutoLoading: %s" % (tool_xml_path)) + tool = self.load_tool(tool_xml_path) + self.tools_by_id[ tool.id ] = tool + self.__add_tool_to_tool_panel( tool, auto_load_section, section=True ) + + self.tool_panel[ "__tool_autoload__" ] = auto_load_section + #self.__add_tool_to_tool_panel( auto_load_section, self.tool_panel, section=False ) + if self.app.name == 'galaxy' and self.integrated_tool_panel_config_has_contents: # Load self.tool_panel based on the order in self.integrated_tool_panel. self.load_tool_panel() @@ -816,7 +833,7 @@ if len( data_table_definitions ) > 0: # Put the data table definition XML in a temporary file. table_definition = '<?xml version="1.0" encoding="utf-8"?>\n<tables>\n %s</tables>' - table_definition = table_definition % '\n'.join( data_table_definitions ) + table_definition = table_definition % '\n'.join( data_table_definitions ) fd, table_conf = tempfile.mkstemp() os.close( fd ) file( table_conf, 'w' ).write( table_definition ) https://bitbucket.org/galaxy/galaxy-central/commits/3a03061c4a85/ Changeset: 3a03061c4a85 Branch: tool-autoload User: kell...@gmail.com Date: 2014-10-01 06:10:09+00:00 Summary: Default Merge Affected #: 116 files diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/galaxy.frame.js --- a/client/galaxy/scripts/galaxy.frame.js +++ b/client/galaxy/scripts/galaxy.frame.js @@ -1,9 +1,8 @@ // dependencies define(["galaxy.masthead", "mvc/ui/ui-frames"], function(mod_masthead, Frames) { -// frame manager -var GalaxyFrame = Backbone.View.extend( -{ +/** Frame manager uses the ui-frames to create the scratch book masthead icon and functionality **/ +var GalaxyFrame = Backbone.View.extend({ // base element el_main: 'body', @@ -17,8 +16,7 @@ button_load : null, // initialize - initialize : function(options) - { + initialize : function(options) { // add to masthead menu var self = this; @@ -28,8 +26,7 @@ }); // add activate icon - this.button_active = new mod_masthead.GalaxyMastheadIcon ( - { + this.button_active = new mod_masthead.GalaxyMastheadIcon({ icon : 'fa-th', tooltip : 'Enable/Disable Scratchbook', onclick : function() { self._activate(); }, @@ -44,8 +41,7 @@ Galaxy.masthead.append(this.button_active); // add load icon - this.button_load = new mod_masthead.GalaxyMastheadIcon ( - { + this.button_load = new mod_masthead.GalaxyMastheadIcon({ icon : 'fa-eye', tooltip : 'Show/Hide Scratchbook', onclick : function(e) { @@ -122,35 +118,77 @@ }); }, + + /** + * Add a trackster visualization to the frames. + */ + add_trackster_viz: function(viz_id) { + var self = this; + require(['viz/visualization', 'viz/trackster'], function(visualization, trackster) { + var viz = new visualization.Visualization({id: viz_id}); + $.when( viz.fetch() ).then( function() { + var ui = new trackster.TracksterUI(galaxy_config.root); + + // Construct frame config based on dataset's type. + var frame_config = { + title: viz.get('name'), + type: 'other', + content: function(parent_elt) { + // Create view config. + var view_config = { + container: parent_elt, + name: viz.get('title'), + id: viz.id, + // FIXME: this will not work with custom builds b/c the dbkey needed to be encoded. + dbkey: viz.get('dbkey'), + stand_alone: false + }, + latest_revision = viz.get('latest_revision'), + drawables = latest_revision.config.view.drawables; + + // Set up datasets in drawables. + _.each(drawables, function(d) { + d.dataset = { + hda_ldda: d.hda_ldda, + id: d.dataset_id + }; + }); + + view = ui.create_visualization(view_config, + latest_revision.config.viewport, + latest_revision.config.view.drawables, + latest_revision.config.bookmarks, + false); + } + }; + + self.add(frame_config); + }); + }); + }, /** * Add and display a new frame/window based on options. */ - add: function(options) - { + add: function(options){ // open new tab - if (options.target == '_blank') - { + if (options.target == '_blank'){ window.open(options.content); return; } // reload entire window - if (options.target == '_top' || options.target == '_parent' || options.target == '_self') - { + if (options.target == '_top' || options.target == '_parent' || options.target == '_self'){ window.location = options.content; return; } // validate - if (!this.active) - { + if (!this.active){ // fix url if main frame is unavailable var $galaxy_main = $(window.parent.document).find('#galaxy_main'); - if (options.target == 'galaxy_main' || options.target == 'center') - { - if ($galaxy_main.length === 0) - { + if (options.target == 'galaxy_main' || options.target == 'center'){ + if ($galaxy_main.length === 0){ var href = options.content; if (href.indexOf('?') == -1) href += '?'; @@ -173,11 +211,9 @@ }, // activate/disable panel - _activate: function () - { + _activate: function (){ // check - if (this.active) - { + if (this.active){ // disable this.active = false; @@ -196,8 +232,7 @@ }, // update frame counter - _refresh: function() - { + _refresh: function(){ // update on screen counter this.button_load.number(this.frames.length()); diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/galaxy.masthead.js --- a/client/galaxy/scripts/galaxy.masthead.js +++ b/client/galaxy/scripts/galaxy.masthead.js @@ -1,9 +1,8 @@ // dependencies define([], function() { -// masthead -var GalaxyMasthead = Backbone.View.extend( -{ +/** Masthead **/ +var GalaxyMasthead = Backbone.View.extend({ // base element el_masthead: '#everything', @@ -17,8 +16,7 @@ list: [], // initialize - initialize : function(options) - { + initialize : function(options) { // update options this.options = options; @@ -51,27 +49,23 @@ }, // configure events - events: - { + events: { 'click' : '_click', 'mousedown' : function(e) { e.preventDefault() } }, // adds a new item to the masthead - append : function(item) - { + append : function(item) { return this._add(item, true); }, // adds a new item to the masthead - prepend : function(item) - { + prepend : function(item) { return this._add(item, false); }, // activate - highlight: function(id) - { + highlight: function(id) { var current = $(this.el).find('#' + id + '> li'); if (current) { current.addClass('active'); @@ -79,11 +73,9 @@ }, // adds a new item to the masthead - _add : function(item, append) - { + _add : function(item, append) { var $loc = $(this.el).find('#' + item.location); - if ($loc) - { + if ($loc){ // create frame for new item var $current = $(item.el); @@ -106,8 +98,7 @@ }, // handle click event - _click: function(e) - { + _click: function(e) { // close all popups var $all = $(this.el).find('.popup'); if ($all) { @@ -129,8 +120,7 @@ */ // fill template - _template: function(options) - { + _template: function(options) { var brand_text = options.brand ? ("/ " + options.brand) : "" ; return '<div><div id="masthead" class="navbar navbar-fixed-top navbar-inverse">' + '<div style="position: relative; right: -50%; float: left;">' + @@ -150,12 +140,10 @@ } }); -// icon -var GalaxyMastheadIcon = Backbone.View.extend( -{ +/** Masthead icon **/ +var GalaxyMastheadIcon = Backbone.View.extend({ // icon options - options: - { + options:{ id : '', icon : 'fa-cog', tooltip : '', @@ -169,8 +157,7 @@ location: 'iconbar', // initialize - initialize: function (options) - { + initialize: function (options){ // read in defaults if (options) this.options = _.defaults(options, this.options); @@ -189,20 +176,17 @@ }, // show - show: function() - { + show: function(){ $(this.el).css({visibility : 'visible'}); }, // show - hide: function() - { + hide: function(){ $(this.el).css({visibility : 'hidden'}); }, // switch icon - icon: function (new_icon) - { + icon: function (new_icon){ // update icon class $(this.el).find('.icon').removeClass(this.options.icon) .addClass(new_icon); @@ -212,26 +196,22 @@ }, // toggle - toggle: function() - { + toggle: function(){ $(this.el).addClass('toggle'); }, // untoggle - untoggle: function() - { + untoggle: function(){ $(this.el).removeClass('toggle'); }, // set/get number - number: function(new_number) - { + number: function(new_number){ $(this.el).find('.number').text(new_number); }, // fill template icon - _template: function (options) - { + _template: function (options){ var tmpl = '<div id="' + options.id + '" class="symbol">' + '<div class="icon fa fa-2x ' + options.icon + '"></div>'; if (options.with_number) @@ -243,12 +223,10 @@ } }); -// tab -var GalaxyMastheadTab = Backbone.View.extend( -{ +/** Masthead tab **/ +var GalaxyMastheadTab = Backbone.View.extend({ // main options - options: - { + options:{ id : '', title : '', target : '_parent', @@ -268,14 +246,12 @@ $menu: null, // events - events: - { + events:{ 'click .head' : '_head' }, // initialize - initialize: function (options) - { + initialize: function (options){ // read in defaults if (options) this.options = _.defaults(options, this.options); @@ -300,20 +276,17 @@ }, // show - show: function() - { + show: function(){ $(this.el).css({visibility : 'visible'}); }, // show - hide: function() - { + hide: function(){ $(this.el).css({visibility : 'hidden'}); }, // add menu item - add: function (options) - { + add: function (options){ // menu option defaults var menuOptions = { title : 'Title', @@ -333,8 +306,7 @@ menuOptions.content = galaxy_config.root + menuOptions.content; // check if submenu element is available - if (!this.$menu) - { + if (!this.$menu){ // insert submenu element into root $(this.el).find('.root').append(this._templateMenu()); @@ -353,8 +325,7 @@ // add events var self = this; - $item.on('click', function(e) - { + $item.on('click', function(e){ // prevent default e.preventDefault(); @@ -372,8 +343,7 @@ }, // show menu on header click - _head: function(e) - { + _head: function(e){ // prevent default e.preventDefault(); @@ -387,8 +357,7 @@ } }, - _attachPopover : function() - { + _attachPopover : function(){ var $popover_element = $(this.el).find('.head'); $popover_element.popover({ html: true, @@ -402,25 +371,21 @@ }, // fill template header - _templateMenuItem: function (options) - { + _templateMenuItem: function (options){ return '<li><a href="' + options.content + '" target="' + options.target + '">' + options.title + '</a></li>'; }, // fill template header - _templateMenu: function () - { + _templateMenu: function (){ return '<ul class="popup dropdown-menu"></ul>'; }, - _templateDivider: function() - { + _templateDivider: function(){ return '<li class="divider"></li>'; }, // fill template - _template: function (options) - { + _template: function (options){ // start template var tmpl = '<ul id="' + options.id + '" class="nav navbar-nav" border="0" cellspacing="0">' + '<li class="root dropdown" style="">' + diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/galaxy.menu.js --- a/client/galaxy/scripts/galaxy.menu.js +++ b/client/galaxy/scripts/galaxy.menu.js @@ -1,13 +1,8 @@ -/* - galaxy menu -*/ - // dependencies define(["galaxy.masthead"], function(mod_masthead) { -// frame manager -var GalaxyMenu = Backbone.Model.extend( -{ +/** GalaxyMenu uses the GalaxyMasthead class in order to add menu items and icons to the Masthead **/ +var GalaxyMenu = Backbone.Model.extend({ // options options: null, @@ -15,16 +10,14 @@ masthead: null, // initialize - initialize: function(options) - { + initialize: function(options) { this.options = options.config; this.masthead = options.masthead; this.create(); }, // default menu - create: function() - { + create: function(){ // // Analyze data tab. // @@ -137,8 +130,7 @@ var tab_visualization = new mod_masthead.GalaxyMastheadTab(visualization_options); - if (this.options.user.valid) //add submenu only when user is logged in - { + if (this.options.user.valid){ //add submenu only when user is logged in tab_visualization.add({ title : "New Track Browser", content : "visualization/trackster", @@ -155,8 +147,7 @@ // // Cloud menu. // - if (this.options.enable_cloud_launch) - { + if (this.options.enable_cloud_launch){ var tab_cloud = new mod_masthead.GalaxyMastheadTab({ id : "cloud", title : "Cloud", @@ -172,8 +163,7 @@ // // Admin. // - if (this.options.is_admin_user) - { + if (this.options.is_admin_user) { var tab_admin = new mod_masthead.GalaxyMastheadTab({ id : "admin", title : "Admin", @@ -192,8 +182,7 @@ title : "Help", title_attribute : 'Support, contact, and community hubs' }); - if (this.options.biostar_url) - { + if (this.options.biostar_url){ tab_help.add({ title : "Galaxy Biostar", content : this.options.biostar_url_redirect, @@ -235,8 +224,7 @@ content : this.options.citation_url, target : "_blank" }); - if (this.options.terms_url) - { + if (this.options.terms_url){ tab_help.add({ title : "Terms and Conditions", content : this.options.terms_url, @@ -248,8 +236,7 @@ // // User tab. // - if (!this.options.user.valid) - { + if (!this.options.user.valid){ var tab_user = new mod_masthead.GalaxyMastheadTab({ id : "user", title : "User", @@ -265,8 +252,7 @@ }); // register - if (this.options.allow_user_creation) - { + if (this.options.allow_user_creation){ tab_user.add({ title : "Register", content : "user/create", @@ -331,8 +317,7 @@ target : "galaxy_main" }); - if (this.options.use_remote_user) - { + if (this.options.use_remote_user){ tab_user.add({ title : "Public Name", content : "user/edit_username?cntrller=user", diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/base-mvc.js --- a/client/galaxy/scripts/mvc/base-mvc.js +++ b/client/galaxy/scripts/mvc/base-mvc.js @@ -380,11 +380,6 @@ /** allow the view to be dragged, set up event handlers */ draggableOn : function(){ this.draggable = true; - //TODO: I have no idea why this doesn't work with the events hash or jq.on()... - //this.$el.find( '.title-bar' ) - // .attr( 'draggable', true ) - // .bind( 'dragstart', this.dragStartHandler, false ) - // .bind( 'dragend', this.dragEndHandler, false ); this.dragStartHandler = _.bind( this._dragStartHandler, this ); this.dragEndHandler = _.bind( this._dragEndHandler, this ); @@ -402,23 +397,22 @@ }, /** sets the dataTransfer data to the model's toJSON - * @fires dragstart (bbone event) which is passed this view + * @fires draggable:dragstart (bbone event) which is passed the event and this view */ _dragStartHandler : function( event ){ - //this.debug( 'dragStartHandler:', this, event, arguments ) - this.trigger( 'dragstart', this ); event.dataTransfer.effectAllowed = 'move'; + //ASSUMES: this.model //TODO: all except IE: should be 'application/json', IE: must be 'text' event.dataTransfer.setData( 'text', JSON.stringify( this.model.toJSON() ) ); + this.trigger( 'draggable:dragstart', event, this ); return false; }, /** handle the dragend - * @fires dragend (bbone event) which is passed this view + * @fires draggable:dragend (bbone event) which is passed the event and this view */ _dragEndHandler : function( event ){ - this.trigger( 'dragend', this ); - //this.debug( 'dragEndHandler:', event ) + this.trigger( 'draggable:dragend', event, this ); return false; } }; diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/dataset/dataset-li-edit.js --- a/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li-edit.js @@ -181,6 +181,8 @@ } var $visualizations = $( this.templates.visualizations( visualizations, this ) ); + //HACK: need to re-write those directed at galaxy_main with linkTarget + $visualizations.find( '[target="galaxy_main"]').attr( 'target', this.linkTarget ); // use addBack here to include the root $visualizations elem (for the case of 1 visualization) this._addScratchBookFn( $visualizations.find( '.visualization-link' ).addBack( '.visualization-link' ) ); return $visualizations; @@ -188,6 +190,7 @@ /** add scratchbook functionality to visualization links */ _addScratchBookFn : function( $links ){ + var li = this; $links.click( function( ev ){ if( Galaxy.frame && Galaxy.frame.active ){ Galaxy.frame.add({ diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/dataset/dataset-li.js --- a/client/galaxy/scripts/mvc/dataset/dataset-li.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-li.js @@ -160,7 +160,7 @@ // add frame manager option onclick event var self = this; displayBtnData.onclick = function( ev ){ - if( Galaxy.frame && Galaxy.frame.active ){ + if (Galaxy.frame && Galaxy.frame.active) { // Add dataset to frames. Galaxy.frame.add_dataset(self.model.get('id')); ev.preventDefault(); diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/dataset/dataset-model.js --- a/client/galaxy/scripts/mvc/dataset/dataset-model.js +++ b/client/galaxy/scripts/mvc/dataset/dataset-model.js @@ -359,74 +359,11 @@ Backbone.Collection.prototype.set.call( this, models, options ); }, -// /** Convert this ad-hoc collection of hdas to a formal collection tracked -// by the server. -// **/ -// promoteToHistoryDatasetCollection : function _promote( history, collection_type, options ){ -////TODO: seems like this would be better in mvc/collections -// options = options || {}; -// options.url = this.url(); -// options.type = "POST"; -// var full_collection_type = collection_type; -// var element_identifiers = [], -// name = null; -// -// // This mechanism is rough - no error handling, allows invalid selections, no way -// // for user to pick/override element identifiers. This is only really meant -// if( collection_type === "list" ) { -// this.chain().each( function( hda ) { -// // TODO: Handle duplicate names. -// var name = hda.attributes.name; -// var id = hda.get('id'); -// var content_type = hda.attributes.history_content_type; -// if( content_type === "dataset" ) { -// if( full_collection_type !== "list" ) { -// this.log( "Invalid collection type" ); -// } -// element_identifiers.push( { name: name, src: "hda", id: id } ); -// } else { -// if( full_collection_type === "list" ) { -// full_collection_type = "list:" + hda.attributes.collection_type; -// } else { -// if( full_collection_type !== "list:" + hda.attributes.collection_type ) { -// this.log( "Invalid collection type" ); -// } -// } -// element_identifiers.push( { name: name, src: "hdca", id: id } ); -// } -// }); -// name = "New Dataset List"; -// } else if( collection_type === "paired" ) { -// var ids = this.ids(); -// if( ids.length !== 2 ){ -// // TODO: Do something... -// } -// element_identifiers.push( { name: "forward", src: "hda", id: ids[ 0 ] } ); -// element_identifiers.push( { name: "reverse", src: "hda", id: ids[ 1 ] } ); -// name = "New Dataset Pair"; -// } -// options.data = { -// type: "dataset_collection", -// name: name, -// collection_type: full_collection_type, -// element_identifiers: JSON.stringify( element_identifiers ) -// }; -// -// var xhr = jQuery.ajax( options ); -// xhr.done( function( message, status, responseObj ){ -// history.refresh( ); -// }); -// xhr.fail( function( xhr, status, message ){ -// if( xhr.responseJSON && xhr.responseJSON.error ){ -// error = xhr.responseJSON.error; -// } else { -// error = xhr.responseJSON; -// } -// xhr.responseText = error; -// // Do something? -// }); -// return xhr; -// }, + ///** Convert this ad-hoc collection of hdas to a formal collection tracked + // by the server. + //**/ + //promoteToHistoryDatasetCollection : function _promote( history, collection_type, options ){ + //}, /** String representation. */ toString : function(){ diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/history/history-contents.js --- a/client/galaxy/scripts/mvc/history/history-contents.js +++ b/client/galaxy/scripts/mvc/history/history-contents.js @@ -187,6 +187,7 @@ /** copy an existing, accessible hda into this collection */ copy : function( id ){ +//TODO: incorp collections var collection = this, xhr = jQuery.post( this.url(), { source : 'hda', diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/history/history-model.js --- a/client/galaxy/scripts/mvc/history/history-model.js +++ b/client/galaxy/scripts/mvc/history/history-model.js @@ -14,7 +14,7 @@ * @constructs */ var History = Backbone.Model.extend( BASE_MVC.LoggableMixin ).extend( -/** @lends History.prototype */{ + BASE_MVC.mixin( BASE_MVC.SearchableModelMixin, /** @lends History.prototype */{ /** logger used to record this.log messages, commonly set to console */ //logger : console, @@ -117,7 +117,19 @@ return _.reduce( _.values( this.get( 'state_details' ) ), function( memo, num ){ return memo + num; }, 0 ); }, - // ........................................................................ ajax + // ........................................................................ search + /** What model fields to search with */ + searchAttributes : [ + 'name', 'annotation', 'tags' + ], + + /** Adding title and singular tag */ + searchAliases : { + title : 'name', + tag : 'tags' + }, + + // ........................................................................ updates /** does the contents collection indicate they're still running and need to be updated later? * delay + update if needed * @param {Function} onReadyCallback function to run when all contents are in the ready state @@ -187,6 +199,18 @@ return xhr; }, + // ........................................................................ ajax + /** save this history, _Mark_ing it as deleted (just a flag) */ + _delete : function( options ){ + if( this.get( 'deleted' ) ){ return jQuery.when(); } + return this.save( { deleted: true }, options ); + }, + /** save this history, _Mark_ing it as undeleted */ + undelete : function( options ){ + if( !this.get( 'deleted' ) ){ return jQuery.when(); } + return this.save( { deleted: false }, options ); + }, + /** Make a copy of this history on the server * @param {Boolean} current if true, set the copy as the new current history (default: true) * @param {String} name name of new history (default: none - server sets to: Copy of <current name>) @@ -210,9 +234,28 @@ //TODO:?? all datasets? var history = this, - xhr = jQuery.post( this.urlRoot, postData ); - xhr.done( function( newData ){ - history.trigger( 'copied', history, newData ); + copy = jQuery.post( this.urlRoot, postData ); + // if current - queue to setAsCurrent before firing 'copied' + if( current ){ + return copy.then( function( response ){ + var newHistory = new History( response ); + return newHistory.setAsCurrent() + .done( function(){ + history.trigger( 'copied', history, response ); + }); + }); + } + return copy.done( function( response ){ + history.trigger( 'copied', history, response ); + }); + }, + + setAsCurrent : function(){ + var history = this, + xhr = jQuery.getJSON( '/history/set_as_current?id=' + this.id ); + + xhr.done( function(){ + history.trigger( 'set-as-current', history ); }); return xhr; }, @@ -221,7 +264,7 @@ toString : function(){ return 'History(' + this.get( 'id' ) + ',' + this.get( 'name' ) + ')'; } -}); +})); //------------------------------------------------------------------------------ CLASS VARS /** When the history has running hdas, @@ -351,12 +394,15 @@ create : function create( data, hdas, historyOptions, xhrOptions ){ var collection = this, - history = new History( data || {}, hdas || [], historyOptions || {} ); - return history.save( xhrOptions ).done( function( newData ){ + xhr = jQuery.getJSON( galaxy_config.root + 'history/create_new_current' ); + return xhr.done( function( newData ){ + var history = new History( newData, [], historyOptions || {} ); // new histories go in the front //TODO: (implicit ordering by update time...) collection.unshift( history ); + collection.trigger( 'new-current' ); }); +//TODO: move back to using history.save (via Deferred.then w/ set_as_current) }, toString: function toString(){ diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/history/history-panel-edit-current.js --- a/client/galaxy/scripts/mvc/history/history-panel-edit-current.js +++ b/client/galaxy/scripts/mvc/history/history-panel-edit-current.js @@ -398,14 +398,17 @@ //TODO: move show_deleted/hidden into panel from opt menu and remove this /** add listeners to an external options menu (templates/webapps/galaxy/root/index.mako) */ connectToOptionsMenu : function( optionsMenu ){ + var panel = this; if( !optionsMenu ){ - return this; + return panel; } // set a visible indication in the popupmenu for show_hidden/deleted based on the currHistoryPanel's settings - this.on( 'new-storage', function( storage, panel ){ - if( optionsMenu && storage ){ - optionsMenu.findItemByHtml( _l( 'Include Deleted Datasets' ) ).checked = storage.get( 'show_deleted' ); - optionsMenu.findItemByHtml( _l( 'Include Hidden Datasets' ) ).checked = storage.get( 'show_hidden' ); + this.on( 'new-storage show-deleted show-hidden', function(){ +//TODO: global + var menu = ( Galaxy && Galaxy.historyOptionsMenu )? Galaxy.historyOptionsMenu : undefined; + if( menu ){ + menu.findItemByHtml( _l( 'Include Deleted Datasets' ) ).checked = panel.showDeleted; + menu.findItemByHtml( _l( 'Include Hidden Datasets' ) ).checked = panel.showHidden; } }); return this; diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/history/history-panel-edit.js --- a/client/galaxy/scripts/mvc/history/history-panel-edit.js +++ b/client/galaxy/scripts/mvc/history/history-panel-edit.js @@ -69,6 +69,17 @@ this.multiselectActions = attributes.multiselectActions || this._getActions(); }, + /** Override to handle history as drag-drop target */ + _setUpListeners : function(){ + _super.prototype._setUpListeners.call( this ); + + this.on( 'drop', function( ev, data ){ + this.dataDropped( data ); + // remove the drop target + this.dropTargetOff(); + }); + }, + // ------------------------------------------------------------------------ listeners /** listening for collection events */ _setUpCollectionListeners : function(){ @@ -104,6 +115,42 @@ return $newRender; }, + /** override to render counts when the items are rendered */ + renderItems : function( $whereTo ){ + var views = _super.prototype.renderItems.call( this, $whereTo ); + this._renderCounts( $whereTo ); + return views; + }, + + /** override to show counts, what's deleted/hidden, and links to toggle those */ + _renderCounts : function( $whereTo ){ +//TODO: too complicated + function toggleLink( _class, text ){ + return [ '<a class="', _class, '" href="javascript:void(0);">', text, '</a>' ].join( '' ); + } + $whereTo = $whereTo || this.$el; + var deleted = this.collection.where({ deleted: true }), + hidden = this.collection.where({ visible: false }), + msgs = []; + + if( this.views.length ){ + msgs.push( [ this.views.length, _l( 'shown' ) ].join( ' ' ) ); + } + if( deleted.length ){ + msgs.push( ( !this.showDeleted )? + ([ deleted.length, toggleLink( 'toggle-deleted-link', _l( 'deleted' ) ) ].join( ' ' )) + :( toggleLink( 'toggle-deleted-link', _l( 'hide deleted' ) ) ) + ); + } + if( hidden.length ){ + msgs.push( ( !this.showHidden )? + ([ hidden.length, toggleLink( 'toggle-hidden-link', _l( 'hidden' ) ) ].join( ' ' )) + :( toggleLink( 'toggle-hidden-link', _l( 'hide hidden' ) ) ) + ); + } + return $whereTo.find( '.subtitle' ).html( msgs.join( ', ' ) ); + }, + /** render the tags sub-view controller */ _renderTags : function( $where ){ var panel = this; @@ -296,10 +343,18 @@ return options; }, + ///** Override to alter data in drag based on multiselection */ + //_setUpItemViewListeners : function( view ){ + // var panel = this; + // _super.prototype._setUpItemViewListeners.call( panel, view ); + // + //}, + /** If this item is deleted and we're not showing deleted items, remove the view * @param {Model} the item model to check */ _handleHdaDeletionChange : function( itemModel ){ + this._renderCounts(); if( itemModel.get( 'deleted' ) && !this.showDeleted ){ this.removeItemView( itemModel ); } @@ -309,6 +364,7 @@ * @param {Model} the item model to check */ _handleHdaVisibleChange : function( itemModel ){ + this._renderCounts(); if( itemModel.hidden() && !this.storage.showHidden ){ this.removeItemView( itemModel ); } @@ -337,7 +393,9 @@ // ------------------------------------------------------------------------ panel events /** event map */ events : _.extend( _.clone( _super.prototype.events ), { - 'click .show-selectors-btn' : 'toggleSelectors' + 'click .show-selectors-btn' : 'toggleSelectors', + 'click .toggle-deleted-link' : function( ev ){ this.toggleShowDeleted(); }, + 'click .toggle-hidden-link' : function( ev ){ this.toggleShowHidden(); } }), /** Update the history size display (curr. upper right of panel). @@ -346,6 +404,132 @@ this.$el.find( '.history-size' ).text( this.model.get( 'nice_size' ) ); }, + // ------------------------------------------------------------------------ as drop target + /** */ + dropTargetOn : function(){ + if( this.dropTarget ){ return this; } + this.dropTarget = true; + + //TODO: to init + var dropHandlers = { + 'dragenter' : _.bind( this.dragenter, this ), + 'dragover' : _.bind( this.dragover, this ), + 'dragleave' : _.bind( this.dragleave, this ), + 'drop' : _.bind( this.drop, this ) + }; +//TODO: scroll to top + var $dropTarget = this._renderDropTarget(); + this.$list().before([ this._renderDropTargetHelp(), $dropTarget ]); + for( var evName in dropHandlers ){ + if( dropHandlers.hasOwnProperty( evName ) ){ + //console.debug( evName, dropHandlers[ evName ] ); + $dropTarget.on( evName, dropHandlers[ evName ] ); + } + } + return this; + }, + + /** */ + _renderDropTarget : function(){ + return $( '<div/>' ).addClass( 'history-drop-target' ) + .css({ + 'height': '64px', + 'margin': '0px 10px 10px 10px', + 'border': '1px dashed black', + 'border-radius' : '3px' + }); + }, + + /** */ + _renderDropTargetHelp : function(){ + return $( '<div/>' ).addClass( 'history-drop-target-help' ) + .css({ + 'margin' : '10px 10px 4px 10px', + 'color' : 'grey', + 'font-size' : '80%', + 'font-style' : 'italic' + }) + .text( _l( 'Drag datasets here to copy them to the current history' ) ); + }, + + /** */ + dropTargetOff : function(){ + if( !this.dropTarget ){ return this; } + //this.log( 'dropTargetOff' ); + this.dropTarget = false; + // + //var dropTarget = this.$( '.history-drop-target' ).get(0); + //for( var evName in this._dropHandlers ){ + // if( this._dropHandlers.hasOwnProperty( evName ) ){ + // console.debug( evName, this._dropHandlers[ evName ] ); + // dropTarget.off( evName, this._dropHandlers[ evName ] ); + // } + //} + this.$( '.history-drop-target' ).remove(); + this.$( '.history-drop-target-help' ).remove(); + return this; + }, + /** */ + dropTargetToggle : function(){ + if( this.dropTarget ){ + this.dropTargetOff(); + } else { + this.dropTargetOn(); + } + return this; + }, + + /** */ + dragenter : function( ev ){ + //console.debug( 'dragenter:', this, ev ); + ev.preventDefault(); + ev.stopPropagation(); + this.$( '.history-drop-target' ).css( 'border', '2px solid black' ); + }, + /** */ + dragover : function( ev ){ + ev.preventDefault(); + ev.stopPropagation(); + }, + /** */ + dragleave : function( ev ){ + //console.debug( 'dragleave:', this, ev ); + ev.preventDefault(); + ev.stopPropagation(); + this.$( '.history-drop-target' ).css( 'border', '1px dashed black' ); + }, + /** */ + drop : function( ev ){ + //console.warn( 'dataTransfer:', ev.dataTransfer.getData( 'text' ) ); + //console.warn( 'dataTransfer:', ev.originalEvent.dataTransfer.getData( 'text' ) ); + ev.preventDefault(); + //ev.stopPropagation(); + ev.dataTransfer.dropEffect = 'move'; + + //console.debug( 'ev.dataTransfer:', ev.dataTransfer ); + + var panel = this, + data = ev.dataTransfer.getData( "text" ); + try { + data = JSON.parse( data ); + + } catch( err ){ + this.warn( 'error parsing JSON from drop:', data ); + } + this.trigger( 'droptarget:drop', ev, data, panel ); + return false; + }, + + /** */ + dataDropped : function( data ){ + var panel = this; + // HDA: dropping will copy it to the history + if( _.isObject( data ) && data.model_class === 'HistoryDatasetAssociation' && data.id ){ + return panel.model.contents.copy( data.id ); + } + return jQuery.when(); + }, + // ........................................................................ misc /** Return a string rep of the history */ toString : function(){ diff -r 7666506937e21d70856474a9406f444799579349 -r 3a03061c4a858d4a1607114e77ab90793b0e5520 client/galaxy/scripts/mvc/history/history-panel.js --- a/client/galaxy/scripts/mvc/history/history-panel.js +++ b/client/galaxy/scripts/mvc/history/history-panel.js @@ -395,6 +395,7 @@ if( store ){ this.storage.set( 'show_deleted', show ); } + this.trigger( 'show-hidden', show ); //TODO:?? to events on storage('change:show_deleted') this.renderItems(); return this.showDeleted; @@ -412,6 +413,7 @@ if( store ){ this.storage.set( 'show_hidden', show ); } + this.trigger( 'show-hidden', show ); //TODO:?? to events on storage('change:show_deleted') this.renderItems(); return this.showHidden; @@ -606,9 +608,7 @@ '<div class="title">', '<div class="name"><%= history.name %></div>', '</div>', - '<div class="subtitle">', - //'<%= view.collection.length %>', _l( ' items' ), - '</div>', + '<div class="subtitle"></div>', '<div class="history-size"><%= history.nice_size %></div>', '<div class="actions"></div>', This diff is so big that we needed to truncate the remainder. https://bitbucket.org/galaxy/galaxy-central/commits/b8db34a82175/ Changeset: b8db34a82175 Branch: tool-autoload User: kell...@gmail.com Date: 2014-10-01 06:12:47+00:00 Summary: Reverting back to default Affected #: 3 files diff -r 3a03061c4a858d4a1607114e77ab90793b0e5520 -r b8db34a82175099ad7e52bde344dd356c7199bb4 config/galaxy.ini.sample --- a/config/galaxy.ini.sample +++ b/config/galaxy.ini.sample @@ -120,7 +120,7 @@ # tool shed install data. There are many situtations in which it is # valuable to seperate these - for instance bootstrapping fresh Galaxy # instances with pretested installs. The following optin can be used to -# separate the tool shed install database (all other options listed above +# separate the tool shed install database (all other options listed above # but prefixed with install_ are also available). #install_database_connection = sqlite:///./database/universe.sqlite?isolation_level=IMMEDIATE @@ -160,14 +160,6 @@ # Other tool config files must include the tool_path as an attribute in the <toolbox> tag. #tool_path = tools -# Path to autoload tools from. -# Every directory inside the autoload directory will be scanned for *.xml files -# and those will be loaded as tool descriptors -#tool_autoload_dir = ./tool-autoload - -# Autoload Panel, for all tools that are autoloaded, they are placed in this tool section -#tool_autoload_section = Development - # Path to the directory in which tool dependencies are placed. This is used by # the tool shed to install dependencies and can also be used by administrators # to manually install or link to dependencies. For details, see: @@ -187,7 +179,7 @@ #watch_tools = False # Enable automatic polling of relative tool sheds to see if any updates -# are available for installed repositories. Ideally only one Galaxy +# are available for installed repositories. Ideally only one Galaxy # server process should be able to check for repository updates. The # setting for hours_between_check should be an integer between 1 and 24. #enable_tool_shed_check = False @@ -252,7 +244,7 @@ #citation_cache_data_dir = database/citations/data #citation_cache_lock_dir = database/citations/lock -# External service types config file, defines what types of external_services configurations +# External service types config file, defines what types of external_services configurations # are available in Galaxy (.sample is used if default does not exist). #external_service_type_config_file = config/external_service_types_conf.xml @@ -361,15 +353,15 @@ # -- Account activation -# This is user account activation feature global flag. If set to "False" the rest of the Account +# This is user account activation feature global flag. If set to "False" the rest of the Account # activation configuration is ignored and user activation is disabled (a.k.a. accounts are active since registration). # Note the activation is also not working in case the smtp server is not defined. #user_activation_on = False -# Activation grace period. Activation is not forced (login is not disabled) until +# Activation grace period. Activation is not forced (login is not disabled) until # grace period has passed. Users under grace period can't run jobs (see inactivity_box_content). -# In hours. Default is 3. Enter 0 to disable grace period. -# Users with OpenID logins have grace period forever. +# In hours. Default is 3. Enter 0 to disable grace period. +# Users with OpenID logins have grace period forever. #activation_grace_period = 0 # Used for warning box for inactive accounts (unable to run jobs). @@ -429,7 +421,7 @@ # - $iso8601 (complete format string as specified by ISO 8601 international standard). # pretty_datetime_format = $locale (UTC) -# The URL of the page to display in Galaxy's middle pane when loaded. This can be +# The URL of the page to display in Galaxy's middle pane when loaded. This can be # an absolute or relative URL. #welcome_url = /static/welcome.html @@ -461,7 +453,7 @@ # The URL linked by the "Galaxy Q&A" link in the "Help" menu # The Galaxy Q&A site is under development; when the site is done, this URL # will be set and uncommented. -#qa_url = +#qa_url = # Serve static content, which must be enabled if you're not serving it via a # proxy server. These options should be self explanatory and so are not @@ -614,7 +606,7 @@ # if testing shows that Galaxy is able to create files using these formats. # Specific formats can be disabled with this option, separate more than one # format with commas. Available formats are currently 'zip', 'gz', and 'bz2'. -#disable_library_comptypes = +#disable_library_comptypes = # Some sequencer integration features in beta allow you to automatically # transfer datasets. This is done using a lightweight transfer manager which @@ -764,7 +756,7 @@ # File where Data Managers are configured (.sample used if default does not # exist) #data_manager_config_file = config/data_manager_conf.xml -# File where Tool Shed based Data Managers are configured +# File where Tool Shed based Data Managers are configured #shed_data_manager_config_file = config/shed_data_manager_conf.xml # Directory to store Data Manager based tool-data; defaults to tool_data_path #galaxy_data_manager_data_path = tool-data @@ -883,11 +875,11 @@ # ---- Galaxy External Message Queue ------------------------------------------------- -# Galaxy uses AMQ protocol to receive messages from external sources like +# Galaxy uses AMQ protocol to receive messages from external sources like # bar code scanners. Galaxy has been tested against RabbitMQ AMQP implementation. -# For Galaxy to receive messages from a message queue the RabbitMQ server has +# For Galaxy to receive messages from a message queue the RabbitMQ server has # to be set up with a user account and other parameters listed below. The 'host' -# and 'port' fields should point to where the RabbitMQ server is running. +# and 'port' fields should point to where the RabbitMQ server is running. [galaxy_amqp] @@ -900,3 +892,4 @@ #exchange = galaxy_exchange #routing_key = bar_code_scanner #rabbitmqctl_path = /path/to/rabbitmqctl + diff -r 3a03061c4a858d4a1607114e77ab90793b0e5520 -r b8db34a82175099ad7e52bde344dd356c7199bb4 lib/galaxy/config.py --- a/lib/galaxy/config.py +++ b/lib/galaxy/config.py @@ -88,9 +88,6 @@ self.user_label_filters = listify( kwargs.get( "user_tool_label_filters", [] ), do_strip=True ) self.user_section_filters = listify( kwargs.get( "user_tool_section_filters", [] ), do_strip=True ) - self.tool_autoload_dir = kwargs.get( "tool_autoload_dir", None ) - self.tool_autoload_section = kwargs.get( "tool_autoload_section", None ) - # Check for tools defined in the above non-shed tool configs (i.e., tool_conf.xml) tht have # been migrated from the Galaxy code distribution to the Tool Shed. self.check_migrate_tools = string_as_bool( kwargs.get( 'check_migrate_tools', True ) ) diff -r 3a03061c4a858d4a1607114e77ab90793b0e5520 -r b8db34a82175099ad7e52bde344dd356c7199bb4 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -159,23 +159,6 @@ self.init_tools( config_filename ) except: log.exception( "Error loading tools defined in config %s", config_filename ) - if self.app.config.tool_autoload_dir is not None: - log.info("Autoloading tool directory: %s" % (self.app.config.tool_autoload_dir)) - - auto_load_section = ToolSection({ - 'id' : "__tool_autoload__", - 'version' : "1.0.0", - 'name' : self.app.config.tool_autoload_section}) - - for tool_xml_path in glob.glob(os.path.join(self.app.config.tool_autoload_dir, "*", "*.xml")): - log.info("AutoLoading: %s" % (tool_xml_path)) - tool = self.load_tool(tool_xml_path) - self.tools_by_id[ tool.id ] = tool - self.__add_tool_to_tool_panel( tool, auto_load_section, section=True ) - - self.tool_panel[ "__tool_autoload__" ] = auto_load_section - #self.__add_tool_to_tool_panel( auto_load_section, self.tool_panel, section=False ) - if self.app.name == 'galaxy' and self.integrated_tool_panel_config_has_contents: # Load self.tool_panel based on the order in self.integrated_tool_panel. self.load_tool_panel() @@ -880,7 +863,7 @@ if len( data_table_definitions ) > 0: # Put the data table definition XML in a temporary file. table_definition = '<?xml version="1.0" encoding="utf-8"?>\n<tables>\n %s</tables>' - table_definition = table_definition % '\n'.join( data_table_definitions ) + table_definition = table_definition % '\n'.join( data_table_definitions ) fd, table_conf = tempfile.mkstemp() os.close( fd ) file( table_conf, 'w' ).write( table_definition ) https://bitbucket.org/galaxy/galaxy-central/commits/890d470c5a61/ Changeset: 890d470c5a61 Branch: tool-autoload User: kell...@gmail.com Date: 2014-10-01 06:57:03+00:00 Summary: Adding tool_library_dir to tool_conf parser. This will cause all the child directories of a given directory to be watched for tools. Affected #: 1 file diff -r b8db34a82175099ad7e52bde344dd356c7199bb4 -r 890d470c5a618cfcb6f53b2f457f8d461ef71fd5 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -236,6 +236,8 @@ self.load_label_tag_set( elem, self.tool_panel, self.integrated_tool_panel, load_panel_dict, index=index ) elif elem.tag == 'tool_dir': self.__watch_directory( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) + elif elem.tag == 'tool_library_dir': + self.__watch_directory_children( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) if parsing_shed_tool_conf: shed_tool_conf_dict = dict( config_filename=config_filename, tool_path=tool_path, @@ -688,6 +690,8 @@ self.load_label_tag_set( sub_elem, elems, integrated_elems, load_panel_dict, index=sub_index ) elif sub_elem.tag == 'tool_dir': self.__watch_directory( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) + elif sub_elem.tag == 'tool_library_dir': + self.__watch_directory_children( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) if load_panel_dict: self.tool_panel[ key ] = section # Always load sections into the integrated_tool_panel. @@ -696,8 +700,16 @@ else: self.integrated_tool_panel.insert( index, key, integrated_section ) - def __watch_directory( self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict ): + def __watch_directory_children( self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict ): directory = os.path.join( tool_path, sub_elem.attrib.get("dir") ) + for sub in os.listdir( directory ): + child = os.path.join(directory, sub) + if os.path.isdir(child): + self.__watch_directory(None, elems, tool_path, integrated_elems, load_panel_dict, child) + + def __watch_directory( self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict, directory=None ): + if directory is None: + directory = os.path.join( tool_path, sub_elem.attrib.get("dir") ) def quick_load( tool_file, async=True ): try: @@ -863,7 +875,7 @@ if len( data_table_definitions ) > 0: # Put the data table definition XML in a temporary file. table_definition = '<?xml version="1.0" encoding="utf-8"?>\n<tables>\n %s</tables>' - table_definition = table_definition % '\n'.join( data_table_definitions ) + table_definition = table_definition % '\n'.join( data_table_definitions ) fd, table_conf = tempfile.mkstemp() os.close( fd ) file( table_conf, 'w' ).write( table_definition ) https://bitbucket.org/galaxy/galaxy-central/commits/a55060d94308/ Changeset: a55060d94308 Branch: tool-autoload User: kellrott Date: 2014-10-01 17:15:43+00:00 Summary: Changing tool_library_repo to work off of tool_dir with attr recursive=True Affected #: 1 file diff -r 890d470c5a618cfcb6f53b2f457f8d461ef71fd5 -r a55060d943081345db52ed74f8564d98af5d501a lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -235,9 +235,8 @@ elif elem.tag == 'label': self.load_label_tag_set( elem, self.tool_panel, self.integrated_tool_panel, load_panel_dict, index=index ) elif elem.tag == 'tool_dir': - self.__watch_directory( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) - elif elem.tag == 'tool_library_dir': - self.__watch_directory_children( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) + self.load_tooldir_tag_set( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) + if parsing_shed_tool_conf: shed_tool_conf_dict = dict( config_filename=config_filename, tool_path=tool_path, @@ -689,9 +688,7 @@ elif sub_elem.tag == 'label': self.load_label_tag_set( sub_elem, elems, integrated_elems, load_panel_dict, index=sub_index ) elif sub_elem.tag == 'tool_dir': - self.__watch_directory( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) - elif sub_elem.tag == 'tool_library_dir': - self.__watch_directory_children( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) + self.load_tooldir_tag_set( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) if load_panel_dict: self.tool_panel[ key ] = section # Always load sections into the integrated_tool_panel. @@ -700,16 +697,12 @@ else: self.integrated_tool_panel.insert( index, key, integrated_section ) - def __watch_directory_children( self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict ): + def load_tooldir_tag_set(self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict): directory = os.path.join( tool_path, sub_elem.attrib.get("dir") ) - for sub in os.listdir( directory ): - child = os.path.join(directory, sub) - if os.path.isdir(child): - self.__watch_directory(None, elems, tool_path, integrated_elems, load_panel_dict, child) + recursive = string_as_bool( sub_elem.attrib.get("recursive", False) ) + self.__watch_directory( directory, elems, integrated_elems, load_panel_dict, recursive ) - def __watch_directory( self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict, directory=None ): - if directory is None: - directory = os.path.join( tool_path, sub_elem.attrib.get("dir") ) + def __watch_directory( self, directory, elems, integrated_elems, load_panel_dict, recursive): def quick_load( tool_file, async=True ): try: @@ -729,16 +722,21 @@ # will be False when things like functional tests are the caller. self.fix_integrated_tool_panel_dict() self.write_integrated_tool_panel_config_file() - return tool.id except Exception: log.exception("Failed to load potential tool %s." % tool_file) return None + tool_loaded = False for name in os.listdir( directory ): - if name.endswith( ".xml" ): - quick_load( os.path.join( directory, name), async=False ) - self.tool_watcher.watch_directory( directory, quick_load ) + child_path = os.path.join(directory, name) + if os.path.isdir(child_path) and recursive: + self.__watch_directory(child_path, elems, integrated_elems, load_panel_dict, recursive) + elif name.endswith( ".xml" ): + quick_load( child_path, async=False ) + tool_loaded = True + if tool_loaded: + self.tool_watcher.watch_directory( directory, quick_load ) def load_tool( self, config_file, guid=None, repository_id=None, **kwds ): """Load a single tool from the file named by `config_file` and return an instance of `Tool`.""" https://bitbucket.org/galaxy/galaxy-central/commits/041438f8b528/ Changeset: 041438f8b528 Branch: tool-autoload User: kellrott Date: 2014-10-02 17:06:53+00:00 Summary: Changing tool_dir in tool_conf to be recursive by default Affected #: 1 file diff -r a55060d943081345db52ed74f8564d98af5d501a -r 041438f8b5281d2ff6618208ff72463b5eeebf52 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -699,7 +699,7 @@ def load_tooldir_tag_set(self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict): directory = os.path.join( tool_path, sub_elem.attrib.get("dir") ) - recursive = string_as_bool( sub_elem.attrib.get("recursive", False) ) + recursive = string_as_bool( sub_elem.attrib.get("recursive", True) ) self.__watch_directory( directory, elems, integrated_elems, load_panel_dict, recursive ) def __watch_directory( self, directory, elems, integrated_elems, load_panel_dict, recursive): https://bitbucket.org/galaxy/galaxy-central/commits/3aa7288f5a97/ Changeset: 3aa7288f5a97 User: jmchilton Date: 2014-10-06 01:31:21+00:00 Summary: Merged in kellrott/galaxy-farm/tool-autoload (pull request #512) Adding tool_library_dir to tool_conf parser Affected #: 3 files diff -r 342ee791fe55b3bca0bbbe86c2e58509a9f96df6 -r 3aa7288f5a97970df22fd38c400237028fe33e4b lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -235,7 +235,8 @@ elif elem.tag == 'label': self.load_label_tag_set( elem, self.tool_panel, self.integrated_tool_panel, load_panel_dict, index=index ) elif elem.tag == 'tool_dir': - self.__watch_directory( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) + self.load_tooldir_tag_set( elem, self.tool_panel, self.integrated_tool_panel, tool_path, load_panel_dict ) + if parsing_shed_tool_conf: shed_tool_conf_dict = dict( config_filename=config_filename, tool_path=tool_path, @@ -687,7 +688,7 @@ elif sub_elem.tag == 'label': self.load_label_tag_set( sub_elem, elems, integrated_elems, load_panel_dict, index=sub_index ) elif sub_elem.tag == 'tool_dir': - self.__watch_directory( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) + self.load_tooldir_tag_set( sub_elem, elems, tool_path, integrated_elems, load_panel_dict ) if load_panel_dict: self.tool_panel[ key ] = section # Always load sections into the integrated_tool_panel. @@ -696,8 +697,12 @@ else: self.integrated_tool_panel.insert( index, key, integrated_section ) - def __watch_directory( self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict ): + def load_tooldir_tag_set(self, sub_elem, elems, tool_path, integrated_elems, load_panel_dict): directory = os.path.join( tool_path, sub_elem.attrib.get("dir") ) + recursive = string_as_bool( sub_elem.attrib.get("recursive", True) ) + self.__watch_directory( directory, elems, integrated_elems, load_panel_dict, recursive ) + + def __watch_directory( self, directory, elems, integrated_elems, load_panel_dict, recursive): def quick_load( tool_file, async=True ): try: @@ -717,16 +722,21 @@ # will be False when things like functional tests are the caller. self.fix_integrated_tool_panel_dict() self.write_integrated_tool_panel_config_file() - return tool.id except Exception: log.exception("Failed to load potential tool %s." % tool_file) return None + tool_loaded = False for name in os.listdir( directory ): - if name.endswith( ".xml" ): - quick_load( os.path.join( directory, name), async=False ) - self.tool_watcher.watch_directory( directory, quick_load ) + child_path = os.path.join(directory, name) + if os.path.isdir(child_path) and recursive: + self.__watch_directory(child_path, elems, integrated_elems, load_panel_dict, recursive) + elif name.endswith( ".xml" ): + quick_load( child_path, async=False ) + tool_loaded = True + if tool_loaded: + self.tool_watcher.watch_directory( directory, quick_load ) def load_tool( self, config_file, guid=None, repository_id=None, **kwds ): """Load a single tool from the file named by `config_file` and return an instance of `Tool`.""" 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.