galaxy-commits
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions

commit/galaxy-central: greg: Add new sample config to point to tools installed from a tool shed and add additional directories for checking/creating at startup.
by Bitbucket 06 Sep '11
by Bitbucket 06 Sep '11
06 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/502e3902ed9d/
changeset: 502e3902ed9d
user: greg
date: 2011-09-06 19:41:06
summary: Add new sample config to point to tools installed from a tool shed and add additional directories for checking/creating at startup.
affected #: 3 files (681 bytes)
--- a/lib/galaxy/config.py Tue Sep 06 11:51:01 2011 -0400
+++ b/lib/galaxy/config.py Tue Sep 06 13:41:06 2011 -0400
@@ -5,7 +5,7 @@
import sys, os, tempfile
import logging, logging.config
import ConfigParser
-from galaxy.util import string_as_bool, listify
+from galaxy.util import string_as_bool, listify, parse_xml
from galaxy import eggs
import pkg_resources
@@ -172,10 +172,21 @@
else:
return default
def check( self ):
+ paths_to_check = [ self.root, self.tool_path, self.tool_data_path, self.template_path ]
+ # Look for any tool shed configs and retrieve the tool_path attribute from the <toolbox> tag.
+ for config_filename in self.tool_configs:
+ tree = parse_xml( config_filename )
+ root = tree.getroot()
+ tool_path = root.get( 'tool_path' )
+ if tool_path not in [ None, False ]:
+ paths_to_check.append( resolve_path( tool_path, self.root ) )
# Check that required directories exist
- for path in self.root, self.tool_path, self.tool_data_path, self.template_path:
- if not os.path.isdir( path ):
- raise ConfigurationError("Directory does not exist: %s" % path )
+ for path in paths_to_check:
+ if path not in [ None, False ] and not os.path.isdir( path ):
+ try:
+ os.makedirs( path )
+ except Exception, e:
+ raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) )
# Create the directories that it makes sense to create
for path in self.file_path, \
self.new_file_path, \
--- a/run.sh Tue Sep 06 11:51:01 2011 -0400
+++ b/run.sh Tue Sep 06 13:41:06 2011 -0400
@@ -6,11 +6,13 @@
[ $? -ne 0 ] && exit 1
SAMPLES="
+ datatypes_conf.xml.sample
external_service_types_conf.xml.sample
- datatypes_conf.xml.sample
reports_wsgi.ini.sample
+ shed_tool_conf.xml.sample
tool_conf.xml.sample
tool_data_table_conf.xml.sample
+ tool_sheds_conf.xml.sample
universe_wsgi.ini.sample
tool-data/shared/ucsc/builds.txt.sample
tool-data/*.sample
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
0

commit/galaxy-central: natefoo: Add the "Galaxy ls" script to contrib/. Thanks, Simon McGowan.
by Bitbucket 06 Sep '11
by Bitbucket 06 Sep '11
06 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/36221b56dfcd/
changeset: 36221b56dfcd
user: natefoo
date: 2011-09-06 17:51:01
summary: Add the "Galaxy ls" script to contrib/. Thanks, Simon McGowan.
affected #: 2 files (239 bytes)
--- a/contrib/README Tue Sep 06 10:44:44 2011 -0400
+++ b/contrib/README Tue Sep 06 11:51:01 2011 -0400
@@ -23,3 +23,9 @@
SMF Manifest for Solaris 10 and OpenSolaris. Import with `svccfg import
galaxy.solaris-smf.xml`.
+
+gls.pl:
+
+ "Galaxy ls", for sites where Galaxy logins match system logins, this script
+ can be used to list the filesystem paths to a user's history datasets.
+ Requires site modifications. Written and submitted by Simon McGowan.
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
0

commit/galaxy-central: greg: Fix for browsing tool shed repo files whose names include apsces, and display a better message if repository metadata cannot be set due to lack of tools.
by Bitbucket 06 Sep '11
by Bitbucket 06 Sep '11
06 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/ba5c95886cef/
changeset: ba5c95886cef
user: greg
date: 2011-09-06 16:44:44
summary: Fix for browsing tool shed repo files whose names include apsces, and display a better message if repository metadata cannot be set due to lack of tools.
affected #: 2 files (197 bytes)
--- a/lib/galaxy/webapps/community/controllers/common.py Tue Sep 06 09:43:17 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Sep 06 10:44:44 2011 -0400
@@ -295,6 +295,9 @@
repository_metadata.metadata = metadata_dict
trans.sa_session.add( repository_metadata )
trans.sa_session.flush()
+ else:
+ message = "Changeset revision '%s' includes no tools or exported workflows for which metadata can be set." % str( changeset_revision )
+ status = "done"
else:
# change_set is None
message = "Repository does not include changeset revision '%s'." % str( changeset_revision )
--- a/lib/galaxy/webapps/community/controllers/repository.py Tue Sep 06 09:43:17 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Sep 06 10:44:44 2011 -0400
@@ -1396,7 +1396,7 @@
changeset_revision=repository.tip,
status=status,
message=message ) )
- return output.split()
+ return output.split( '\r\n' )
@web.json
def get_file_contents( self, trans, file_path ):
# Avoid caching
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
0

06 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/8d261709b1e1/
changeset: 8d261709b1e1
user: greg
date: 2011-09-06 15:43:17
summary: datatime import fixes in the base controller.
affected #: 2 files (36 bytes)
--- a/lib/galaxy/web/base/controller.py Mon Sep 05 07:07:43 2011 -0400
+++ b/lib/galaxy/web/base/controller.py Tue Sep 06 09:43:17 2011 -0400
@@ -2,7 +2,7 @@
Contains functionality needed in every web interface
"""
import os, time, logging, re, string, sys, glob, shutil, tempfile, subprocess
-from datetime import *
+from datetime import date, datetime, timedelta
from time import strftime
from galaxy import config, tools, web, util
from galaxy.web import error, form, url_for
--- a/lib/galaxy/webapps/community/controllers/repository.py Mon Sep 05 07:07:43 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Sep 06 09:43:17 2011 -0400
@@ -1,7 +1,6 @@
import os, logging, urllib, ConfigParser, tempfile, shutil, pexpect
from time import strftime
-from datetime import *
-
+from datetime import date, datetime
from galaxy import util
from galaxy.datatypes.checkers import *
from galaxy.web.base.controller import *
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
0

commit/galaxy-central: greg: Fix for defining the relative file path for a tool automatically installed from a tool shed.
by Bitbucket 05 Sep '11
by Bitbucket 05 Sep '11
05 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/6f321d52b8af/
changeset: 6f321d52b8af
user: greg
date: 2011-09-05 13:07:43
summary: Fix for defining the relative file path for a tool automatically installed from a tool shed.
affected #: 1 file (288 bytes)
--- a/lib/galaxy/web/base/controller.py Fri Sep 02 18:32:13 2011 -0400
+++ b/lib/galaxy/web/base/controller.py Mon Sep 05 07:07:43 2011 -0400
@@ -2768,11 +2768,8 @@
try:
repository_tool = trans.app.toolbox.load_tool( full_path )
if repository_tool:
- # At this point, we need to lstrip tool_path from relative_path,m but we
- # have to be careful, so we do this the following way instead of using lstrip().
- items = relative_path.split( '/' )
- lstriped_items = items[ 2: ]
- tup_path = '/'.join( lstriped_items )
+ # At this point, we need to lstrip tool_path from relative_path.
+ tup_path = relative_path.replace( tool_path, '' ).lstrip( '/' )
repository_tools_tups.append( ( tup_path, repository_tool ) )
except Exception, e:
# We have an inavlid .xml file, so not a tool config.
@@ -2894,7 +2891,7 @@
Generate a tool path that guarantees repositories with the same name will always be installed
in different directories. The tool path will be of the form:
<tool shed url>/repos/<repository owner>/<repository name>/<changeset revision>
- http://test@gvk.bx.psu.edu:9009/repos/test/filter
+ http://test@bx.psu.edu:9009/repos/test/filter
"""
tmp_url = self.__clean_repository_clone_url( repository_clone_url )
# Now tmp_url is something like: bx.psu.edu:9009/repos/some_username/column
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
0

commit/galaxy-central: jgoecks: Trackster: simplify track iteration during save.
by Bitbucket 03 Sep '11
by Bitbucket 03 Sep '11
03 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/c6416712537b/
changeset: c6416712537b
user: jgoecks
date: 2011-09-03 00:32:13
summary: Trackster: simplify track iteration during save.
affected #: 1 file (292 bytes)
--- a/templates/tracks/browser.mako Fri Sep 02 18:00:16 2011 -0400
+++ b/templates/tracks/browser.mako Fri Sep 02 18:32:13 2011 -0400
@@ -204,32 +204,25 @@
"Save": function() {
// Show saving dialog box
show_modal("Saving...", "<img src='${h.url_for('/static/images/yui/rel_interstitial_loading.gif')}'/>");
+
+ // TODO: make save into its own function.
// Save tracks.
- var tracks = [];
- $(".viewport-container .track").each(function () {
- // ID has form track_<main_track_id>_<child_track_id>
- var
- id_split = $(this).attr("id").split("_"),
- track_id = id_split[1],
- child_id = id_split[2];
-
- // Get track.
- var track = view.tracks[track_id];
- if (child_id) {
- track = track.child_tracks[child_id];
- }
+ var saved_tracks = [], tracks;
+ for (var i = 0; i < view.tracks.length; i++) {
+ track = view.tracks[i];
// Add track.
- tracks.push({
+ saved_tracks.push({
"track_type": track.get_type(),
"name": track.name,
"hda_ldda": track.hda_ldda,
"dataset_id": track.dataset_id,
"prefs": track.prefs,
- "is_child": (child_id ? true : false )
+ // TODO: remove parent-child relationships in favor of a group.
+ "is_child": false
});
- });
+ };
// Save bookmarks.
var bookmarks = [];
@@ -242,7 +235,7 @@
var overview_track_name = (view.overview_track ? view.overview_track.name : null);
var payload = {
- 'tracks': tracks,
+ 'tracks': saved_tracks,
'viewport': { 'chrom': view.chrom, 'start': view.low , 'end': view.high, 'overview': overview_track_name },
'bookmarks': bookmarks
};
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
0

commit/galaxy-central: jgoecks: Trackster: properly remove tracks from view's track array.
by Bitbucket 03 Sep '11
by Bitbucket 03 Sep '11
03 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a02763fbe84a/
changeset: a02763fbe84a
user: jgoecks
date: 2011-09-03 00:00:16
summary: Trackster: properly remove tracks from view's track array.
affected #: 1 file (3 bytes)
--- a/static/scripts/trackster.js Fri Sep 02 15:53:04 2011 -0400
+++ b/static/scripts/trackster.js Fri Sep 02 18:00:16 2011 -0400
@@ -896,7 +896,7 @@
*/
remove_track: function(track) {
this.has_changes = true;
- delete this.tracks[this.tracks.indexOf(track)];
+ this.tracks.splice(this.tracks.indexOf(track), 1);
this.num_tracks -= 1;
var view = this;
track.container_div.fadeOut('slow', function() {
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
0

commit/galaxy-central: greg: A couple of bug fixes in handling tool shed installs.
by Bitbucket 02 Sep '11
by Bitbucket 02 Sep '11
02 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/cf8748a743a7/
changeset: cf8748a743a7
user: greg
date: 2011-09-02 21:53:04
summary: A couple of bug fixes in handling tool shed installs.
affected #: 1 file (524 bytes)
--- a/lib/galaxy/web/base/controller.py Fri Sep 02 14:59:31 2011 -0400
+++ b/lib/galaxy/web/base/controller.py Fri Sep 02 15:53:04 2011 -0400
@@ -2768,10 +2768,15 @@
try:
repository_tool = trans.app.toolbox.load_tool( full_path )
if repository_tool:
- repository_tools_tups.append( ( relative_path.lstrip( '%s/' % tool_path ), repository_tool ) )
+ # At this point, we need to lstrip tool_path from relative_path,m but we
+ # have to be careful, so we do this the following way instead of using lstrip().
+ items = relative_path.split( '/' )
+ lstriped_items = items[ 2: ]
+ tup_path = '/'.join( lstriped_items )
+ repository_tools_tups.append( ( tup_path, repository_tool ) )
except Exception, e:
# We have an inavlid .xml file, so not a tool config.
- log.debug("Ignoring invalid tool config (%s)." % str( relative_path ))
+ log.debug( "Ignoring invalid tool config (%s). Error: %s" % ( str( relative_path ), str( e ) ) )
if repository_tools_tups:
# Generate an in-memory tool conf section that includes the new tools.
new_tool_section = self.__generate_tool_panel_section( repository_name,
@@ -2865,7 +2870,7 @@
if tool_shed_url.find( ':' ) > 0:
# Eliminate the port, if any, since it will result in an invalid directory name.
return tool_shed_url.split( ':' )[ 0 ]
- return tool_shed_url
+ return tool_shed_url.rstrip( '/' )
def __clean_repository_clone_url( self, repository_clone_url ):
if repository_clone_url.find( '@' ) > 0:
# We have an url that includes an authenticated user, something like:
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
0

02 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/29a8fa81b603/
changeset: 29a8fa81b603
user: greg
date: 2011-09-02 20:59:31
summary: Add the ability for a Galaxy administrator to automatically install tools from a configured Galaxy tool shed into their local Galaxy installation. Documentation will be available in the tool shed wiki shortly.
affected #: 9 files (44.9 KB)
--- a/lib/galaxy/web/base/controller.py Fri Sep 02 14:57:33 2011 -0400
+++ b/lib/galaxy/web/base/controller.py Fri Sep 02 14:59:31 2011 -0400
@@ -1,8 +1,9 @@
"""
Contains functionality needed in every web interface
"""
-import os, time, logging, re, string, sys, glob
-from datetime import datetime, timedelta
+import os, time, logging, re, string, sys, glob, shutil, tempfile, subprocess
+from datetime import *
+from time import strftime
from galaxy import config, tools, web, util
from galaxy.web import error, form, url_for
from galaxy.model.orm import *
@@ -15,6 +16,10 @@
from Cheetah.Template import Template
+
+pkg_resources.require( 'elementtree' )
+from elementtree import ElementTree, ElementInclude
+
log = logging.getLogger( __name__ )
# States for passing messages
@@ -1153,22 +1158,14 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
+ toolbox = self.app.toolbox
+ if params.get( 'reload_tool_button', False ):
+ tool_id = params.tool_id
+ message, status = toolbox.reload_tool_by_id( tool_id )
return trans.fill_template( '/admin/reload_tool.mako',
- toolbox=self.app.toolbox,
+ toolbox=toolbox,
message=message,
status=status )
- @web.expose
- @web.require_admin
- def tool_reload( self, trans, tool_version=None, **kwd ):
- params = util.Params( kwd )
- tool_id = params.tool_id
- self.app.toolbox.reload( tool_id )
- message = 'Reloaded tool: ' + tool_id
- return trans.fill_template( '/admin/reload_tool.mako',
- toolbox=self.app.toolbox,
- message=message,
- status='done' )
-
# Galaxy Role Stuff
@web.expose
@web.require_admin
@@ -2693,9 +2690,268 @@
msg = msg,
status = status,
job_lock = trans.app.job_manager.job_queue.job_lock )
+ @web.expose
+ @web.require_admin
+ def browse_tool_shed( self, trans, **kwd ):
+ tool_shed_name = kwd[ 'tool_shed_name' ]
+ tool_shed_url = kwd[ 'tool_shed_url' ]
+ galaxy_url = trans.request.host
+ url = '%s/repository/browse_downloadable_repositories?tool_shed_name=%s&galaxy_url=%s&webapp=community' % ( tool_shed_url, tool_shed_name, galaxy_url )
+ return trans.response.send_redirect( url )
+ @web.expose
+ @web.require_admin
+ def install_tool_shed_repository( self, trans, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ tool_shed_url = kwd[ 'tool_shed_url' ]
+ repository_name = kwd[ 'repository_name' ]
+ changeset_revision = kwd[ 'changeset_revision' ]
+ repository_clone_url = kwd[ 'repository_clone_url' ]
+ if kwd.get( 'select_tool_panel_section_button', False ):
+ shed_tool_conf = kwd[ 'shed_tool_conf' ]
+ # Get the tool path.
+ for k, tool_path in trans.app.toolbox.shed_tool_confs.items():
+ if k == shed_tool_conf:
+ break
+ if 'tool_panel_section' in kwd:
+ section_key = 'section_%s' % kwd[ 'tool_panel_section' ]
+ tool_section = trans.app.toolbox.tool_panel[ section_key ]
+ # Clone the repository to the configured location.
+ current_working_dir = os.getcwd()
+ clone_dir = os.path.join( tool_path, self.__generate_tool_path( repository_clone_url, changeset_revision ) )
+ if os.path.exists( clone_dir ):
+ # Repository and revision has already been cloned.
+ # TODO: implement the ability to re-install or revert an existing repository.
+ message = 'Revision <b>%s</b> of repository <b>%s</b> has already been installed. Updating an existing repository is not yet supported.' % \
+ ( changeset_revision, repository_name )
+ status = 'error'
+ else:
+ os.makedirs( clone_dir )
+ cmd = 'hg clone %s' % repository_clone_url
+ log.debug( 'Cloning: %s' % repository_clone_url )
+ tmp_name = tempfile.NamedTemporaryFile().name
+ tmp_stderr = open( tmp_name, 'wb' )
+ os.chdir( clone_dir )
+ proc = subprocess.Popen( args=cmd, shell=True, stderr=tmp_stderr.fileno() )
+ returncode = proc.wait()
+ os.chdir( current_working_dir )
+ tmp_stderr.close()
+ if returncode == 0:
+ repo_files_dir = os.path.join( clone_dir, repository_name )
+ log.debug( 'Updating cloned repository to revision: %s' % changeset_revision )
+ cmd = 'hg update -r %s' % changeset_revision
+ tmp_name = tempfile.NamedTemporaryFile().name
+ tmp_stderr = open( tmp_name, 'wb' )
+ os.chdir( repo_files_dir )
+ proc = subprocess.Popen( cmd, shell=True, stderr=tmp_stderr.fileno() )
+ returncode = proc.wait()
+ os.chdir( current_working_dir )
+ tmp_stderr.close()
+ if returncode == 0:
+ # The repository_tools_tups list contains tuples of ( relative_path_to_tool_config, tool ) pairs
+ repository_tools_tups = []
+ for root, dirs, files in os.walk( repo_files_dir ):
+ if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
+ if '.hg' in dirs:
+ # Don't visit .hg directories - should be impossible since we don't
+ # allow uploaded archives that contain .hg dirs, but just in case...
+ dirs.remove( '.hg' )
+ if 'hgrc' in files:
+ # Don't include hgrc files in commit.
+ files.remove( 'hgrc' )
+ for name in files:
+ # Find all tool configs.
+ if name.endswith( '.xml' ):
+ relative_path = os.path.join( root, name )
+ full_path = os.path.abspath( os.path.join( root, name ) )
+ try:
+ repository_tool = trans.app.toolbox.load_tool( full_path )
+ if repository_tool:
+ repository_tools_tups.append( ( relative_path.lstrip( '%s/' % tool_path ), repository_tool ) )
+ except Exception, e:
+ # We have an inavlid .xml file, so not a tool config.
+ log.debug("Ignoring invalid tool config (%s)." % str( relative_path ))
+ if repository_tools_tups:
+ # Generate an in-memory tool conf section that includes the new tools.
+ new_tool_section = self.__generate_tool_panel_section( repository_name,
+ repository_clone_url,
+ changeset_revision,
+ tool_section,
+ repository_tools_tups )
+ # Create a temporary file to persist the in-memory tool section
+ # TODO: Figure out how to do this in-memory using xml.etree.
+ tmp_name = tempfile.NamedTemporaryFile().name
+ persisted_new_tool_section = open( tmp_name, 'wb' )
+ persisted_new_tool_section.write( new_tool_section )
+ persisted_new_tool_section.close()
+ # Parse the persisted tool panel section
+ tree = ElementTree.parse( tmp_name )
+ root = tree.getroot()
+ ElementInclude.include( root )
+ # Load the tools in the section into the tool panel.
+ trans.app.toolbox.load_section_tag_set( root, trans.app.toolbox.tool_panel, tool_path )
+ # Remove the temporary file
+ try:
+ os.unlink( tmp_name )
+ except:
+ pass
+ # Append the new section to the shed_tool_config file.
+ self.__add_shed_tool_conf_entry( trans, shed_tool_conf, new_tool_section )
+ message = 'Revision <b>%s</b> of repository <b>%s</b> has been installed in tool panel section <b>%s</b>.' % \
+ ( changeset_revision, repository_name, tool_section.name )
+ return trans.show_ok_message( message )
+ else:
+ tmp_stderr = open( tmp_name, 'rb' )
+ message = tmp_stderr.read()
+ tmp_stderr.close()
+ status = 'error'
+ else:
+ tmp_stderr = open( tmp_name, 'rb' )
+ message = tmp_stderr.read()
+ tmp_stderr.close()
+ status = 'error'
+ else:
+ message = 'Choose the section in your tool panel to contain the installed tools.'
+ status = 'error'
+ if len( trans.app.toolbox.shed_tool_confs.keys() ) > 1:
+ shed_tool_conf_select_field = build_shed_tool_conf_select_field( trans )
+ shed_tool_conf = None
+ else:
+ shed_tool_conf = trans.app.toolbox.shed_tool_confs.keys()[0].lstrip( './' )
+ shed_tool_conf_select_field = None
+ tool_panel_section_select_field = build_tool_panel_section_select_field( trans )
+ return trans.fill_template( '/admin/select_tool_panel_section.mako',
+ tool_shed_url=tool_shed_url,
+ repository_name=repository_name,
+ changeset_revision=changeset_revision,
+ repository_clone_url=repository_clone_url,
+ shed_tool_conf=shed_tool_conf,
+ shed_tool_conf_select_field=shed_tool_conf_select_field,
+ tool_panel_section_select_field=tool_panel_section_select_field,
+ message=message,
+ status=status )
+ def __add_shed_tool_conf_entry( self, trans, shed_tool_conf, new_tool_section ):
+ # Add an entry in the shed_tool_conf file. An entry looks something like:
+ # <section name="Filter and Sort" id="filter">
+ # <tool file="filter/filtering.xml" guid="toolshed.g2.bx.psu.edu/repos/test/filter/1.0.2"/>
+ # </section>
+ # Make a backup of the hgweb.config file since we're going to be changing it.
+ if not os.path.exists( shed_tool_conf ):
+ output = open( shed_tool_conf, 'w' )
+ output.write( '<?xml version="1.0"?>\n' )
+ output.write( '<toolbox tool_path="%s">\n' % tool_path )
+ output.write( '</toolbox>\n' )
+ output.close()
+ self.__make_shed_tool_conf_copy( trans, shed_tool_conf )
+ tmp_fd, tmp_fname = tempfile.mkstemp()
+ new_shed_tool_conf = open( tmp_fname, 'wb' )
+ for i, line in enumerate( open( shed_tool_conf ) ):
+ if line.startswith( '</toolbox>' ):
+ # We're at the end of the original config file, so add our entry.
+ new_shed_tool_conf.write( new_tool_section )
+ new_shed_tool_conf.write( line )
+ else:
+ new_shed_tool_conf.write( line )
+ new_shed_tool_conf.close()
+ shutil.move( tmp_fname, os.path.abspath( shed_tool_conf ) )
+ def __make_shed_tool_conf_copy( self, trans, shed_tool_conf ):
+ # Make a backup of the shed_tool_conf file.
+ today = date.today()
+ backup_date = today.strftime( "%Y_%m_%d" )
+ shed_tool_conf_copy = '%s/%s_%s_backup' % ( trans.app.config.root, shed_tool_conf, backup_date )
+ shutil.copy( os.path.abspath( shed_tool_conf ), os.path.abspath( shed_tool_conf_copy ) )
+ def __clean_tool_shed_url( self, tool_shed_url ):
+ if tool_shed_url.find( ':' ) > 0:
+ # Eliminate the port, if any, since it will result in an invalid directory name.
+ return tool_shed_url.split( ':' )[ 0 ]
+ return tool_shed_url
+ def __clean_repository_clone_url( self, repository_clone_url ):
+ if repository_clone_url.find( '@' ) > 0:
+ # We have an url that includes an authenticated user, something like:
+ # http://test@bx.psu.edu:9009/repos/some_username/column
+ items = repository_clone_url.split( '@' )
+ tmp_url = items[ 1 ]
+ elif repository_clone_url.find( '\/\/' ) > 0:
+ # We have an url that includes only a protocol, something like:
+ # http://bx.psu.edu:9009/repos/some_username/column
+ items = repository_clone_url.split( '\/\/' )
+ tmp_url = items[ 1 ]
+ else:
+ tmp_url = repository_clone_url
+ return tmp_url
+ def __get_repository_owner( self, cleaned_repository_url ):
+ items = cleaned_repository_url.split( 'repos' )
+ repo_path = items[ 1 ]
+ return repo_path.lstrip( '/' ).split( '/' )[ 0 ]
+ def __generate_tool_path( self, repository_clone_url, changeset_revision ):
+ """
+ Generate a tool path that guarantees repositories with the same name will always be installed
+ in different directories. The tool path will be of the form:
+ <tool shed url>/repos/<repository owner>/<repository name>/<changeset revision>
+ http://test@gvk.bx.psu.edu:9009/repos/test/filter
+ """
+ tmp_url = self.__clean_repository_clone_url( repository_clone_url )
+ # Now tmp_url is something like: bx.psu.edu:9009/repos/some_username/column
+ items = tmp_url.split( 'repos' )
+ tool_shed_url = items[ 0 ]
+ repo_path = items[ 1 ]
+ tool_shed_url = self.__clean_tool_shed_url( tool_shed_url )
+ return '%s/repos%s/%s' % ( tool_shed_url, repo_path, changeset_revision )
+ def __generate_tool_guid( self, repository_clone_url, tool ):
+ """
+ Generate a guid for the installed tool. It is critical that this guid matches the guid for
+ the tool in the Galaxy tool shed from which it is being installed. The form of the guid is
+ <tool shed host>/repos/<repository owner>/<repository name>/<tool id>/<tool version>
+ """
+ tmp_url = self.__clean_repository_clone_url( repository_clone_url )
+ return '%s/%s/%s' % ( tmp_url, tool.id, tool.version )
+ def __generate_tool_panel_section( self, repository_name, repository_clone_url, changeset_revision, tool_section, repository_tools_tups ):
+ """
+ Write an in-memory tool panel section so we can load it into the tool panel and then
+ append it to the appropriate shed tool config.
+ """
+ tmp_url = self.__clean_repository_clone_url( repository_clone_url )
+ section_str = ''
+ section_str += ' <section name="%s" id="%s">\n' % ( tool_section.name, tool_section.id )
+ for repository_tool_tup in repository_tools_tups:
+ tool_file_path, tool = repository_tool_tup
+ guid = self.__generate_tool_guid( repository_clone_url, tool )
+ section_str += ' <tool file="%s" guid="%s">\n' % ( tool_file_path, guid )
+ section_str += ' <tool_shed>%s</tool_shed>\n' % tmp_url.split( 'repos' )[ 0 ].rstrip( '/' )
+ section_str += ' <repository_name>%s</repository_name>\n' % repository_name
+ section_str += ' <repository_owner>%s</repository_owner>\n' % self.__get_repository_owner( tmp_url )
+ section_str += ' <changeset_revision>%s</changeset_revision>\n' % changeset_revision
+ section_str += ' <id>%s</id>\n' % tool.id
+ section_str += ' <version>%s</version>\n' % tool.version
+ section_str += ' </tool>\n'
+ section_str += ' </section>\n'
+ return section_str
## ---- Utility methods -------------------------------------------------------
+def build_shed_tool_conf_select_field( trans ):
+ """
+ Build a SelectField whose options are the keys in trans.app.toolbox.shed_tool_confs.
+ """
+ options = []
+ for shed_tool_conf_filename, tool_path in trans.app.toolbox.shed_tool_confs.items():
+ options.append( ( shed_tool_conf_filename.lstrip( './' ), shed_tool_conf_filename ) )
+ select_field = SelectField( name='shed_tool_conf' )
+ for option_tup in options:
+ select_field.add_option( option_tup[0], option_tup[1] )
+ return select_field
+def build_tool_panel_section_select_field( trans ):
+ """
+ Build a SelectField whose options are the sections of the current in-memory toolbox.
+ """
+ options = []
+ for k, tool_section in trans.app.toolbox.tool_panel.items():
+ options.append( ( tool_section.name, tool_section.id ) )
+ select_field = SelectField( name='tool_panel_section', display='radio' )
+ for option_tup in options:
+ select_field.add_option( option_tup[0], option_tup[1] )
+ return select_field
def get_user( trans, id ):
"""Get a User from the database by id."""
# Load user from database
--- a/lib/galaxy/webapps/community/controllers/common.py Fri Sep 02 14:57:33 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Fri Sep 02 14:59:31 2011 -0400
@@ -145,6 +145,14 @@
# The received metadata_dict includes no metadata for workflows, so a new repository_metadata table
# record is not needed.
return False
+def generate_clone_url( trans, repository_id ):
+ repository = get_repository( trans, repository_id )
+ protocol, base = trans.request.base.split( '://' )
+ if trans.user:
+ username = '%s@' % trans.user.username
+ else:
+ username = ''
+ return '%s://%s%s/repos/%s/%s' % ( protocol, username, base, repository.user.username, repository.name )
def generate_tool_guid( trans, repository, tool ):
"""
Generate a guid for the received tool. The form of the guid is
@@ -478,7 +486,7 @@
ToolClass = Tool
return ToolClass( config_file, root, trans.app )
return None
-def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True ):
+def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True, galaxy_url=None ):
"""
Build a SelectField whose options are the changeset_revision
strings of all downloadable_revisions of the received repository.
@@ -492,9 +500,15 @@
options.append( ( revision_label, changeset_revision ) )
refresh_on_change_values.append( changeset_revision )
if add_id_to_name:
- name = 'changeset_revision_%d' % repository.id
+ if galaxy_url:
+ name = '%s_changeset_revision_%d' % ( galaxy_url, repository.id )
+ else:
+ name = 'changeset_revision_%d' % repository.id
else:
- name = 'changeset_revision'
+ if galaxy_url:
+ name = '%s_changeset_revision' % galaxy_url
+ else:
+ name = 'changeset_revision'
select_field = SelectField( name=name,
refresh_on_change=True,
refresh_on_change_values=refresh_on_change_values )
--- a/lib/galaxy/webapps/community/controllers/repository.py Fri Sep 02 14:57:33 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Fri Sep 02 14:59:31 2011 -0400
@@ -123,6 +123,7 @@
return 'yes'
return ''
# Grid definition
+ galaxy_url = None
title = "Repositories"
model_class = model.Repository
template='/webapps/community/repository/grid.mako'
@@ -183,8 +184,48 @@
.outerjoin( model.RepositoryCategoryAssociation.table ) \
.outerjoin( model.Category.table )
+class DownloadableRepositoryListGrid( RepositoryListGrid ):
+ class RevisionColumn( grids.GridColumn ):
+ def __init__( self, col_name ):
+ grids.GridColumn.__init__( self, col_name )
+ def get_value( self, trans, grid, repository ):
+ """
+ Display a SelectField whose options are the changeset_revision
+ strings of all downloadable_revisions of this repository.
+ """
+ select_field = build_changeset_revision_select_field( trans,
+ repository,
+ galaxy_url=grid.galaxy_url )
+ if len( select_field.options ) > 1:
+ return select_field.get_html()
+ return repository.revision
+ columns = [
+ RepositoryListGrid.NameColumn( "Name",
+ key="name",
+ attach_popup=True ),
+ RepositoryListGrid.DescriptionColumn( "Synopsis",
+ key="description",
+ attach_popup=False ),
+ RevisionColumn( "Revision" ),
+ RepositoryListGrid.UserColumn( "Owner",
+ model_class=model.User,
+ attach_popup=False,
+ key="User.username" )
+ ]
+ columns.append( grids.MulticolFilterColumn( "Search repository name, description",
+ cols_to_filter=[ columns[0], columns[1] ],
+ key="free-text-search",
+ visible=False,
+ filterable="standard" ) )
+ operations = []
+ def build_initial_query( self, trans, **kwd ):
+ return trans.sa_session.query( self.model_class ) \
+ .join( model.RepositoryMetadata.table ) \
+ .join( model.User.table )
+
class RepositoryController( BaseController, ItemRatings ):
+ downloadable_repository_list_grid = DownloadableRepositoryListGrid()
repository_list_grid = RepositoryListGrid()
category_list_grid = CategoryListGrid()
@@ -215,6 +256,111 @@
# Render the list view
return self.category_list_grid( trans, **kwd )
@web.expose
+ def browse_downloadable_repositories( self, trans, **kwd ):
+ tool_shed_name = kwd.get( 'tool_shed_name', None )
+ repository_id = kwd.get( 'id', None )
+ galaxy_url = kwd.get( 'galaxy_url', None )
+ if 'operation' in kwd:
+ operation = kwd[ 'operation' ].lower()
+ if operation == "preview_tools_in_changeset":
+ repository = get_repository( trans, repository_id )
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='preview_tools_in_changeset',
+ repository_id=repository_id,
+ changeset_revision=repository.tip,
+ galaxy_url=galaxy_url ) )
+
+ # The changeset_revision_select_field in the RepositoryListGrid performs a refresh_on_change
+ # which sends in request parameters like changeset_revison_1, changeset_revision_2, etc. One
+ # of the many select fields on the grid performed the refresh_on_change, so we loop through
+ # all of the received values to see which value is not the repository tip. If we find it, we
+ # know the refresh_on_change occurred, and we have the necessary repository id and change set
+ # revision to pass on.
+ for k, v in kwd.items():
+ changset_revision_str = 'changeset_revision_'
+ if k.startswith( changset_revision_str ):
+ repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) )
+ repository = get_repository( trans, repository_id )
+ if repository.tip != v:
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='preview_tools_in_changeset',
+ repository_id=trans.security.encode_id( repository.id ),
+ changeset_revision=v,
+ galaxy_url=galaxy_url ) )
+ elif k.find( changset_revision_str ) > 0:
+ # Keys look like: 'localhost:8763_changeset_revision_3' and values: '4ef2cf631604'.
+ items = k.split( '_%s' % changset_revision_str )
+ galaxy_url = items[0]
+ repository_id = trans.security.encode_id( int( items[1] ) )
+ repository = get_repository( trans, repository_id )
+ if repository.tip != v:
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='preview_tools_in_changeset',
+ repository_id=trans.security.encode_id( repository.id ),
+ changeset_revision=v,
+ galaxy_url=galaxy_url ) )
+
+ if tool_shed_name:
+ title = "%s downloadable repositories" % tool_shed_name
+ else:
+ title = "Downloadable repositories"
+ self.downloadable_repository_list_grid.title = title
+ self.downloadable_repository_list_grid.galaxy_url = galaxy_url
+ url_args = dict( action='browse_downloadable_repositories',
+ operation='preview_tools_in_changeset',
+ repository_id=repository_id,
+ galaxy_url=galaxy_url )
+ self.downloadable_repository_list_grid.operations = [ grids.GridOperation( "Preview and install tools",
+ url_args=url_args,
+ allow_multiple=False,
+ async_compatible=False ) ]
+
+ # Render the list view
+ return self.downloadable_repository_list_grid( trans, **kwd )
+ @web.expose
+ def preview_tools_in_changeset( self, trans, repository_id, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ galaxy_url = util.restore_text( params.get( 'galaxy_url', '' ) )
+ repository = get_repository( trans, repository_id )
+ changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) )
+ repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ else:
+ metadata = None
+ revision_label = get_revision_label( trans, repository, changeset_revision )
+ changeset_revision_select_field = build_changeset_revision_select_field( trans,
+ repository,
+ selected_value=changeset_revision,
+ add_id_to_name=False )
+ return trans.fill_template( '/webapps/community/repository/preview_tools_in_changeset.mako',
+ repository=repository,
+ changeset_revision=changeset_revision,
+ revision_label=revision_label,
+ changeset_revision_select_field=changeset_revision_select_field,
+ metadata=metadata,
+ galaxy_url=galaxy_url,
+ display_for_install=True,
+ message=message,
+ status=status )
+ @web.expose
+ def install_repository_revision( self, trans, repository_id, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ galaxy_url = util.restore_text( params.get( 'galaxy_url', '' ) )
+ repository = get_repository( trans, repository_id )
+ changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) )
+ # Redirect back to local Galaxy to perform install.
+ tool_shed_url = trans.request.host
+ repository_clone_url = generate_clone_url( trans, repository_id )
+ # TODO: support https in the following url.
+ url = 'http://%s/admin/install_tool_shed_repository?tool_shed_url=%s&repository_name=%s&repository_clone_url=%s&changeset_revision=%s' % \
+ ( galaxy_url, tool_shed_url, repository.name, repository_clone_url, changeset_revision )
+ return trans.response.send_redirect( url )
+ @web.expose
def browse_repositories( self, trans, **kwd ):
# We add params to the keyword dict in this method in order to rename the param
# with an "f-" prefix, simulating filtering by clicking a search link. We have
@@ -1079,45 +1225,57 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
+ galaxy_url = util.restore_text( params.get( 'galaxy_url', '' ) )
+ display_for_install = util.string_as_bool( params.get( 'display_for_install', False ) )
repository = get_repository( trans, repository_id )
- old_version_msg = "The path to your selected version of this tool does not exist in the repository tip, " + \
- "so it cannot be previewed, but you can inspect the tool version's metadata using it's pop-up menu " + \
- "and you can download your selected version of this tool from the <b>Repository Actions</b> menu."
+ repo = hg.repository( get_configured_ui(), repository.repo_path )
try:
- tool = load_tool( trans, os.path.abspath( tool_config ) )
- can_preview = True
- if changeset_revision != repository.tip:
- # See if we are attempting to preview an old version of a tool.
- # TODO: Previewing an old version of a tool is not currently supported because
- # the received tool_config is a file on the file system. We need to implement
- # an enhancement here to look at the repository manifest files if previewing an
- # old version of a tool.
- repo_changeset_repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
- repo_changeset_metadata = repo_changeset_repository_metadata.metadata
- if 'tools' in repo_changeset_metadata:
- for tool_metadata_dict in repo_changeset_metadata[ 'tools' ]:
- if tool_metadata_dict[ 'id' ] == tool.id:
- if tool_metadata_dict[ 'version' ] != tool.version:
- can_preview = False
- message = old_version_msg
- if can_preview:
- tool_state = self.__new_state( trans )
- is_malicious = change_set_is_malicious( trans, repository_id, repository.tip )
- return trans.fill_template( "/webapps/community/repository/tool_form.mako",
- repository=repository,
- tool=tool,
- tool_state=tool_state,
- is_malicious=is_malicious,
- message=message,
- status=status )
+ if changeset_revision == repository.tip:
+ # Get the tool config from the file system we use for browsing.
+ tool = load_tool( trans, os.path.abspath( tool_config ) )
+ else:
+ # Get the tool config file name from the hgweb url, something like:
+ # /repos/test/convert_chars1/file/e58dcf0026c7/convert_characters.xml
+ old_tool_config_file_name = tool_config.split( '/' )[ -1 ]
+ ctx = get_changectx_for_changeset( trans, repo, changeset_revision )
+ for filename in ctx:
+ if filename == old_tool_config_file_name:
+ fctx = ctx[ filename ]
+ break
+ # Write the contents of the old tool config to a temporary file.
+ fh = tempfile.NamedTemporaryFile( 'w' )
+ tmp_filename = fh.name
+ fh.close()
+ fh = open( tmp_filename, 'w' )
+ fh.write( fctx.data() )
+ fh.close()
+ tool = load_tool( trans, tmp_filename )
+ try:
+ os.unlink( tmp_filename )
+ except:
+ pass
+ tool_state = self.__new_state( trans )
+ is_malicious = change_set_is_malicious( trans, repository_id, repository.tip )
+ return trans.fill_template( "/webapps/community/repository/tool_form.mako",
+ repository=repository,
+ changeset_revision=changeset_revision,
+ tool=tool,
+ tool_state=tool_state,
+ is_malicious=is_malicious,
+ display_for_install=display_for_install,
+ galaxy_url=galaxy_url,
+ message=message,
+ status=status )
except Exception, e:
- # TODO: enhance this to check the repository manifest for the files and
- # display the tool using them.
- exception_str = str( e )
- if exception_str.find( 'No such file or directory' ) >= 0:
- message = old_version_msg
- else:
- message = "Error loading tool: %s. Click <b>Reset metadata</b> to correct this error." % exception_str
+ message = "Error loading tool: %s. Click <b>Reset metadata</b> to correct this error." % str( e )
+ if display_for_install:
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='preview_tools_in_changeset',
+ repository_id=repository_id,
+ changeset_revision=changeset_revision,
+ galaxy_url=galaxy_url,
+ message=message,
+ status='error' ) )
return trans.response.send_redirect( web.url_for( controller='repository',
action='browse_repositories',
operation='view_or_manage_repository',
--- a/templates/webapps/community/repository/common.mako Fri Sep 02 14:57:33 2011 -0400
+++ b/templates/webapps/community/repository/common.mako Fri Sep 02 14:59:31 2011 -0400
@@ -77,12 +77,121 @@
<%def name="render_clone_str( repository )"><%
- protocol, base = trans.request.base.split( '://' )
- if trans.user:
- username = '%s@' % trans.user.username
- else:
- username = ''
- clone_str = '%s://%s%s/repos/%s/%s' % ( protocol, username, base, repository.user.username, repository.name )
+ from galaxy.webapps.community.controllers.common import generate_clone_url
+ clone_str = generate_clone_url( trans, trans.security.encode_id( repository.id ) )
%>
hg clone <a href="${clone_str}">${clone_str}</a></%def>
+
+<%def name="render_repository_tools_and_workflows( metadata, can_set_metadata=False, display_for_install=False, galaxy_url=None )">
+ %if metadata or can_set_metadata:
+ <p/>
+ <div class="toolForm">
+ <div class="toolFormTitle">Preview tools and inspect metadata by tool version</div>
+ <div class="toolFormBody">
+ %if metadata:
+ %if 'tools' in metadata:
+ <div class="form-row">
+ <table width="100%">
+ <tr bgcolor="#D8D8D8" width="100%">
+ <td><b>Tools</b><i> - click the name to preview the tool and use the pop-up menu to inspect all metadata</i></td>
+ </tr>
+ </table>
+ </div>
+ <div class="form-row">
+ <% tool_dicts = metadata[ 'tools' ] %>
+ <table class="grid">
+ <tr>
+ <td><b>name</b></td>
+ <td><b>description</b></td>
+ <td><b>version</b></td>
+ <td><b>requirements</b></td>
+ </tr>
+ %for tool_dict in tool_dicts:
+ <tr>
+ <td>
+ <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
+ <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision, display_for_install=display_for_install, galaxy_url=galaxy_url )}">
+ ${tool_dict[ 'name' ]}
+ </a>
+ </div>
+ <div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ], display_for_install=display_for_install, galaxy_url=galaxy_url )}">View tool metadata</a>
+ </div>
+ </td>
+ <td>${tool_dict[ 'description' ]}</td>
+ <td>${tool_dict[ 'version' ]}</td>
+ <td>
+ <%
+ if 'requirements' in tool_dict:
+ requirements = tool_dict[ 'requirements' ]
+ else:
+ requirements = None
+ %>
+ %if requirements:
+ <%
+ requirements_str = ''
+ for requirement_dict in tool_dict[ 'requirements' ]:
+ requirements_str += '%s (%s), ' % ( requirement_dict[ 'name' ], requirement_dict[ 'type' ] )
+ requirements_str = requirements_str.rstrip( ', ' )
+ %>
+ ${requirements_str}
+ %else:
+ none
+ %endif
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ %endif
+ %if 'workflows' in metadata:
+ <div class="form-row">
+ <table width="100%">
+ <tr bgcolor="#D8D8D8" width="100%">
+ <td><b>Workflows</b></td>
+ </tr>
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ <div class="form-row">
+ <% workflow_dicts = metadata[ 'workflows' ] %>
+ <table class="grid">
+ <tr>
+ <td><b>name</b></td>
+ <td><b>format-version</b></td>
+ <td><b>annotation</b></td>
+ </tr>
+ %for workflow_dict in workflow_dicts:
+ <tr>
+ <td>${workflow_dict[ 'name' ]}</td>
+ <td>${workflow_dict[ 'format-version' ]}</td>
+ <td>${workflow_dict[ 'annotation' ]}</td>
+ </tr>
+ %endfor
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ %endif
+ %endif
+ %if can_set_metadata:
+ %if repository.tip == changeset_revision:
+ ## TODO: when we support previewing older versions of tools, we
+ ## should allow resetting metadata on the older versions as well.
+ <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=changeset_revision )}" method="post">
+ <div class="form-row">
+ <div style="float: left; width: 250px; margin-right: 10px;">
+ <input type="submit" name="set_metadata_button" value="Reset metadata"/>
+ </div>
+ <div class="toolParamHelp" style="clear: both;">
+ Inspect the repository and reset the above attributes for the repository tip.
+ </div>
+ </div>
+ </form>
+ %endif
+ %endif
+ </div>
+ </div>
+ %endif
+</%def>
--- a/templates/webapps/community/repository/manage_repository.mako Fri Sep 02 14:57:33 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Fri Sep 02 14:59:31 2011 -0400
@@ -184,114 +184,7 @@
</form></div></div>
-%if can_set_metadata:
- <p/>
- <div class="toolForm">
- <div class="toolFormTitle">Preview tools in repository tip and inspect metadata by tool version</div>
- <div class="toolFormBody">
- %if metadata:
- %if 'tools' in metadata:
- <div class="form-row">
- <table width="100%">
- <tr bgcolor="#D8D8D8" width="100%">
- <td><b>Tools</b><i> - click the name to preview the tool and use the pop-up menu to inspect all metadata</i></td>
- </tr>
- </table>
- </div>
- <div class="form-row">
- <% tool_dicts = metadata[ 'tools' ] %>
- <table class="grid">
- <tr>
- <td><b>name</b></td>
- <td><b>description</b></td>
- <td><b>version</b></td>
- <td><b>requirements</b></td>
- </tr>
- %for tool_dict in tool_dicts:
- <tr>
- <td>
- <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
- <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision )}">
- ${tool_dict[ 'name' ]}
- </a>
- </div>
- <div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View tool metadata</a>
- </div>
- </td>
- <td>${tool_dict[ 'description' ]}</td>
- <td>${tool_dict[ 'version' ]}</td>
- <td>
- <%
- if 'requirements' in tool_dict:
- requirements = tool_dict[ 'requirements' ]
- else:
- requirements = None
- %>
- %if requirements:
- <%
- requirements_str = ''
- for requirement_dict in tool_dict[ 'requirements' ]:
- requirements_str += '%s (%s), ' % ( requirement_dict[ 'name' ], requirement_dict[ 'type' ] )
- requirements_str = requirements_str.rstrip( ', ' )
- %>
- ${requirements_str}
- %else:
- none
- %endif
- </td>
- </tr>
- %endfor
- </table>
- </div>
- <div style="clear: both"></div>
- %endif
- %if 'workflows' in metadata:
- <div class="form-row">
- <table width="100%">
- <tr bgcolor="#D8D8D8" width="100%">
- <td><b>Workflows</b></td>
- </tr>
- </table>
- </div>
- <div style="clear: both"></div>
- <div class="form-row">
- <% workflow_dicts = metadata[ 'workflows' ] %>
- <table class="grid">
- <tr>
- <td><b>name</b></td>
- <td><b>format-version</b></td>
- <td><b>annotation</b></td>
- </tr>
- %for workflow_dict in workflow_dicts:
- <tr>
- <td>${workflow_dict[ 'name' ]}</td>
- <td>${workflow_dict[ 'format-version' ]}</td>
- <td>${workflow_dict[ 'annotation' ]}</td>
- </tr>
- %endfor
- </table>
- </div>
- <div style="clear: both"></div>
- %endif
- %endif
- %if repository.tip == changeset_revision:
- ## TODO: when we support previewing older versions of tools, we
- ## should allow resetting metadata on the older versions as well.
- <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=changeset_revision )}" method="post">
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="submit" name="set_metadata_button" value="Reset metadata"/>
- </div>
- <div class="toolParamHelp" style="clear: both;">
- Inspect the repository and reset the above attributes for the repository tip.
- </div>
- </div>
- </form>
- %endif
- </div>
- </div>
-%endif
+${render_repository_tools_and_workflows( metadata, can_set_metadata=True )}
<p/><div class="toolForm"><div class="toolFormTitle">Manage categories</div>
--- a/templates/webapps/community/repository/tool_form.mako Fri Sep 02 14:57:33 2011 -0400
+++ b/templates/webapps/community/repository/tool_form.mako Fri Sep 02 14:59:31 2011 -0400
@@ -25,7 +25,7 @@
<html><head>
- <title>Galaxy tool display</title>
+ <title>Galaxy tool preview</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
${h.css( "base" )}
</head>
@@ -110,37 +110,41 @@
<br/><br/><ul class="manage-table-actions">
- %if is_new:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ %if display_for_install:
+ <a class="action-button" href="${h.url_for( controller='repository', action='install_repository_revision', repository_id=trans.security.encode_id( repository.id ), webapp='community', changeset_revision=changeset_revision, galaxy_url=galaxy_url )}">Install to local Galaxy</a>
%else:
- <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li>
- <div popupmenu="repository-${repository.id}-popup">
- %if can_manage:
- <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
- %else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
- %endif
- %if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
- %endif
- %if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
- %endif
- %if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
- %endif
- %if can_rate:
- <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
- %endif
- %if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
- %endif
- %if can_download:
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a>
- %endif
- </div>
+ %if is_new:
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ %else:
+ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li>
+ <div popupmenu="repository-${repository.id}-popup">
+ %if can_manage:
+ <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a>
+ %else:
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a>
+ %endif
+ %if can_upload:
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ %endif
+ %if can_view_change_log:
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
+ %endif
+ %if can_browse_contents:
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
+ %endif
+ %if can_rate:
+ <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
+ %endif
+ %if can_contact_owner:
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
+ %endif
+ %if can_download:
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a>
+ %endif
+ </div>
+ %endif
%endif
</ul>
@@ -149,7 +153,7 @@
%endif
<div class="toolForm" id="${tool.id}">
- <div class="toolFormTitle">${tool.name} ${tool.version}</div>
+ <div class="toolFormTitle">${tool.name} (version ${tool.version})</div><div class="toolFormBody"><form id="tool_form" name="tool_form" action="" method="get"><input type="hidden" name="tool_state" value="${util.object_to_string( tool_state.encode( tool, app ) )}">
--- a/templates/webapps/community/repository/view_repository.mako Fri Sep 02 14:57:33 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Fri Sep 02 14:59:31 2011 -0400
@@ -176,98 +176,7 @@
%endif
</div></div>
-%if metadata:
- <p/>
- <div class="toolForm">
- <div class="toolFormTitle">Preview tools in repository tip and inspect metadata by tool version</div>
- <div class="toolFormBody">
- %if 'tools' in metadata:
- <div class="form-row">
- <table width="100%">
- <tr bgcolor="#D8D8D8" width="100%">
- <td><b>Tools</b><i> - click the name to preview the tool and use the pop-up menu to inspect all metadata</i></td>
- </tr>
- </table>
- </div>
- <div class="form-row">
- <% tool_dicts = metadata[ 'tools' ] %>
- <table class="grid">
- <tr>
- <td><b>name</b></td>
- <td><b>description</b></td>
- <td><b>version</b></td>
- <td><b>requirements</b></td>
- </tr>
- %for tool_dict in tool_dicts:
- <tr>
- <td>
- <div style="float: left; margin-left: 1px;" class="menubutton split popup" id="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
- <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision )}">
- ${tool_dict[ 'name' ]}
- </a>
- </div>
- <div popupmenu="tool-${tool_dict[ 'id' ].replace( ' ', '_' )}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View tool metadata</a>
- </div>
- </td>
- <td>${tool_dict[ 'description' ]}</td>
- <td>${tool_dict[ 'version' ]}</td>
- <td>
- <%
- if 'requirements' in tool_dict:
- requirements = tool_dict[ 'requirements' ]
- else:
- requirements = None
- %>
- %if requirements:
- <%
- requirements_str = ''
- for requirement_dict in tool_dict[ 'requirements' ]:
- requirements_str += '%s (%s), ' % ( requirement_dict[ 'name' ], requirement_dict[ 'type' ] )
- requirements_str = requirements_str.rstrip( ', ' )
- %>
- ${requirements_str}
- %else:
- none
- %endif
- </td>
- </tr>
- %endfor
- </table>
- </div>
- <div style="clear: both"></div>
- %endif
- %if 'workflows' in metadata:
- <div class="form-row">
- <table width="100%">
- <tr bgcolor="#D8D8D8" width="100%">
- <td><b>Workflows</b></td>
- </tr>
- </table>
- </div>
- <div style="clear: both"></div>
- <div class="form-row">
- <% workflow_dicts = metadata[ 'workflows' ] %>
- <table class="grid">
- <tr>
- <td><b>name</b></td>
- <td><b>format-version</b></td>
- <td><b>annotation</b></td>
- </tr>
- %for workflow_dict in workflow_dicts:
- <tr>
- <td>${workflow_dict[ 'name' ]}</td>
- <td>${workflow_dict[ 'format-version' ]}</td>
- <td>${workflow_dict[ 'annotation' ]}</td>
- </tr>
- %endfor
- </table>
- </div>
- <div style="clear: both"></div>
- %endif
- </div>
- </div>
-%endif
+${render_repository_tools_and_workflows( metadata )}
%if repository.categories:
<p/><div class="toolForm">
--- a/templates/webapps/galaxy/admin/index.mako Fri Sep 02 14:57:33 2011 -0400
+++ b/templates/webapps/galaxy/admin/index.mako Fri Sep 02 14:59:31 2011 -0400
@@ -39,57 +39,59 @@
<div class="page-container" style="padding: 10px;"><div class="toolMenu"><div class="toolSectionList">
- <div class="toolSectionTitle">
- Security
- </div>
+ <div class="toolSectionTitle">Security</div><div class="toolSectionBody">
- <div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='users', webapp=webapp )}" target="galaxy_main">Manage users</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='groups', webapp=webapp )}" target="galaxy_main">Manage groups</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='roles', webapp=webapp )}" target="galaxy_main">Manage roles</a></div>
- </div>
+ <div class="toolSectionBg">
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='users', webapp=webapp )}" target="galaxy_main">Manage users</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='groups', webapp=webapp )}" target="galaxy_main">Manage groups</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='roles', webapp=webapp )}" target="galaxy_main">Manage roles</a></div>
+ </div></div><div class="toolSectionPad"></div>
- <div class="toolSectionTitle">
- Data
- </div>
+ <div class="toolSectionTitle">Data</div><div class="toolSectionBody">
- <div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='quotas', webapp=webapp )}" target="galaxy_main">Manage quotas</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='library_admin', action='browse_libraries' )}" target="galaxy_main">Manage data libraries</a></div>
- </div>
+ <div class="toolSectionBg">
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='quotas', webapp=webapp )}" target="galaxy_main">Manage quotas</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='library_admin', action='browse_libraries' )}" target="galaxy_main">Manage data libraries</a></div>
+ </div></div><div class="toolSectionPad"></div>
- <div class="toolSectionTitle">
- Server
+ <div class="toolSectionTitle">Server</div>
+ <div class="toolSectionBody">
+ <div class="toolSectionBg">
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='reload_tool' )}" target="galaxy_main">Reload a tool's configuration</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='memdump' )}" target="galaxy_main">Profile memory usage</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='jobs' )}" target="galaxy_main">Manage jobs</a></div>
+ </div></div>
+ %if trans.app.tool_shed_registry and trans.app.tool_shed_registry.tool_sheds:
+ <div class="toolSectionPad"></div>
+ <div class="toolSectionTitle">Tool sheds</div>
+ <div class="toolSectionBody">
+ <div class="toolSectionBg">
+ %for name, url in trans.app.tool_shed_registry.tool_sheds.items():
+ <div class="toolTitle"><a href="${h.url_for( controller='admin', action='browse_tool_shed', tool_shed_name=name, tool_shed_url=url )}" target="galaxy_main">${name}</a></div>
+ %endfor
+ </div>
+ </div>
+ </div>
+ %endif
+ <div class="toolSectionPad"></div>
+ <div class="toolSectionTitle">Form Definitions</div><div class="toolSectionBody">
- <div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='reload_tool' )}" target="galaxy_main">Reload a tool's configuration</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='memdump' )}" target="galaxy_main">Profile memory usage</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='admin', action='jobs' )}" target="galaxy_main">Manage jobs</a></div>
- </div>
+ <div class="toolSectionBg">
+ <div class="toolTitle"><a href="${h.url_for( controller='forms', action='browse_form_definitions' )}" target="galaxy_main">Manage form definitions</a></div>
+ </div></div><div class="toolSectionPad"></div>
- <div class="toolSectionTitle">
- Form Definitions
- </div>
+ <div class="toolSectionTitle">Sample Tracking</div><div class="toolSectionBody">
- <div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='forms', action='browse_form_definitions' )}" target="galaxy_main">Manage form definitions</a></div>
- </div>
- </div>
- <div class="toolSectionPad"></div>
- <div class="toolSectionTitle">
- Sample Tracking
- </div>
- <div class="toolSectionBody">
- <div class="toolSectionBg">
- <div class="toolTitle"><a href="${h.url_for( controller='external_service', action='browse_external_services' )}" target="galaxy_main">Manage sequencers and external services</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='request_type', action='browse_request_types' )}" target="galaxy_main">Manage request types</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_requests' )}" target="galaxy_main">Sequencing requests</a></div>
- <div class="toolTitle"><a href="${h.url_for( controller='requests_common', action='find_samples', cntrller='requests_admin' )}" target="galaxy_main">Find samples</a></div>
- </div>
+ <div class="toolSectionBg">
+ <div class="toolTitle"><a href="${h.url_for( controller='external_service', action='browse_external_services' )}" target="galaxy_main">Manage sequencers and external services</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='request_type', action='browse_request_types' )}" target="galaxy_main">Manage request types</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='requests_admin', action='browse_requests' )}" target="galaxy_main">Sequencing requests</a></div>
+ <div class="toolTitle"><a href="${h.url_for( controller='requests_common', action='find_samples', cntrller='requests_admin' )}" target="galaxy_main">Find samples</a></div>
+ </div></div></div></div>
@@ -97,8 +99,6 @@
</%def><%def name="center_panel()">
- <%
- center_url = h.url_for( action='center', webapp='galaxy' )
- %>
+ <% center_url = h.url_for( action='center', webapp='galaxy' ) %><iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def>
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
0

commit/galaxy-central: greg: Enhance Galaxy tool initialization to do the following:
by Bitbucket 02 Sep '11
by Bitbucket 02 Sep '11
02 Sep '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/ad227f6403bb/
changeset: ad227f6403bb
user: greg
date: 2011-09-02 20:57:33
summary: Enhance Galaxy tool initialization to do the following:
1. Support multiple tool_conf.xml files with tool_conf.xml being the default. Additional files must use the tool shed XML rules.
2. Allow new added tools to be loaded into a selected tool panel section wothout requiring a Galaxy server restart.
3. Add a new tool shed registry, enabling configuring of tool sheds for communication with the local Galaxy instance.
Also add the version of the tool to the form heading when loaded into tool_fom.mako, and clean up the code for reloading a tool in the tool panel.
affected #: 9 files (2.5 KB)
--- a/lib/galaxy/app.py Fri Sep 02 14:37:09 2011 -0400
+++ b/lib/galaxy/app.py Fri Sep 02 14:57:33 2011 -0400
@@ -3,6 +3,7 @@
from galaxy import config, jobs, util, tools, web
import galaxy.tools.search
import galaxy.tools.data
+import galaxy.tools.tool_shed_registry
from galaxy.web import security
import galaxy.model
import galaxy.datatypes.registry
@@ -23,6 +24,11 @@
# Set up datatypes registry
self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config )
galaxy.model.set_datatypes_registry( self.datatypes_registry )
+ # Set up the tool sheds registry
+ if os.path.isfile( self.config.tool_sheds_config ):
+ self.tool_shed_registry = galaxy.tools.tool_shed_registry.Registry( self.config.root, self.config.tool_sheds_config )
+ else:
+ self.tool_shed_registry = None
# Determine the database url
if self.config.database_connection:
db_url = self.config.database_connection
@@ -44,7 +50,7 @@
# Tool data tables
self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_table_config_path )
# Initialize the tools
- self.toolbox = tools.ToolBox( self.config.tool_config, self.config.tool_path, self )
+ self.toolbox = tools.ToolBox( self.config.tool_configs, self.config.tool_path, self )
# Search support for tools
self.toolbox_search = galaxy.tools.search.ToolBoxSearch( self.toolbox )
# Load datatype converters
--- a/lib/galaxy/config.py Fri Sep 02 14:37:09 2011 -0400
+++ b/lib/galaxy/config.py Fri Sep 02 14:57:33 2011 -0400
@@ -5,7 +5,7 @@
import sys, os, tempfile
import logging, logging.config
import ConfigParser
-from galaxy.util import string_as_bool
+from galaxy.util import string_as_bool, listify
from galaxy import eggs
import pkg_resources
@@ -46,11 +46,12 @@
self.enable_api = string_as_bool( kwargs.get( 'enable_api', False ) )
self.enable_openid = string_as_bool( kwargs.get( 'enable_openid', False ) )
self.enable_quotas = string_as_bool( kwargs.get( 'enable_quotas', False ) )
+ self.tool_sheds_config = kwargs.get( 'tool_sheds_config_file', 'tool_sheds_conf.xml' )
self.tool_path = resolve_path( kwargs.get( "tool_path", "tools" ), self.root )
self.tool_data_path = resolve_path( kwargs.get( "tool_data_path", "tool-data" ), os.getcwd() )
self.len_file_path = kwargs.get( "len_file_path", resolve_path(os.path.join(self.tool_data_path, 'shared','ucsc','chrom'), self.root) )
self.test_conf = resolve_path( kwargs.get( "test_conf", "" ), self.root )
- self.tool_config = resolve_path( kwargs.get( 'tool_config_file', 'tool_conf.xml' ), self.root )
+ self.tool_configs = [ resolve_path( p, self.root ) for p in listify( kwargs.get( 'tool_config_file', 'tool_conf.xml' ) ) ]
self.tool_data_table_config_path = resolve_path( kwargs.get( 'tool_data_table_config_path', 'tool_data_table_conf.xml' ), self.root )
self.tool_secret = kwargs.get( "tool_secret", "" )
self.id_secret = kwargs.get( "id_secret", "USING THE DEFAULT IS NOT SECURE!" )
@@ -194,9 +195,11 @@
except Exception, e:
raise ConfigurationError( "Unable to create missing directory: %s\n%s" % ( path, e ) )
# Check that required files exist
- for path in self.tool_config, self.datatypes_config:
+ for path in self.tool_configs:
if not os.path.isfile(path):
raise ConfigurationError("File not found: %s" % path )
+ if not os.path.isfile( self.datatypes_config ):
+ raise ConfigurationError("File not found: %s" % path )
# Check for deprecated options.
for key in self.config_dict.keys():
if key in self.deprecated_options:
--- a/lib/galaxy/tools/__init__.py Fri Sep 02 14:37:09 2011 -0400
+++ b/lib/galaxy/tools/__init__.py Fri Sep 02 14:57:33 2011 -0400
@@ -28,6 +28,7 @@
from galaxy.datatypes import sniff
from cgi import FieldStorage
from galaxy.util.hash_util import *
+from galaxy.util import listify
log = logging.getLogger( __name__ )
@@ -39,23 +40,28 @@
Container for a collection of tools
"""
- def __init__( self, config_filename, tool_root_dir, app ):
+ def __init__( self, config_filenames, tool_root_dir, app ):
"""
Create a toolbox from the config file names by `config_filename`,
using `tool_root_directory` as the base directory for finding
individual tool config files.
"""
+ # The shed_tool_confs dictionary contains shed_conf_filename : tool_path pairs.
+ self.shed_tool_confs = {}
self.tools_by_id = {}
self.workflows_by_id = {}
self.tool_panel = odict()
+ # The following refers to the tool_path config setting for backward compatibility.
+ # Additional newer (e.g., shed_tool_conf.xml) files include the tool_path attribute
+ # within the <toolbox> tag.
self.tool_root_dir = tool_root_dir
self.app = app
self.init_dependency_manager()
- try:
- self.init_tools( config_filename )
- except:
- log.exception( "ToolBox error reading %s", config_filename )
-
+ for config_filename in listify( config_filenames ):
+ try:
+ self.init_tools( config_filename )
+ except:
+ log.exception( "ToolBox error reading %s", config_filename )
def init_tools( self, config_filename ):
"""
Read the configuration file and load each tool.
@@ -71,83 +77,99 @@
</section></toolbox>
"""
- def load_tool( elem, panel_dict ):
- try:
- path = elem.get( "file" )
- tool = self.load_tool( os.path.join( self.tool_root_dir, path ) )
- if self.app.config.get_bool( 'enable_tool_tags', False ):
- tag_names = elem.get( "tags", "" ).split( "," )
- for tag_name in tag_names:
- if tag_name == '':
- continue
- tag = self.sa_session.query( self.app.model.Tag ).filter_by( name=tag_name ).first()
- if not tag:
- tag = self.app.model.Tag( name=tag_name )
- self.sa_session.add( tag )
- self.sa_session.flush()
- tta = self.app.model.ToolTagAssociation( tool_id=tool.id, tag_id=tag.id )
- self.sa_session.add( tta )
- self.sa_session.flush()
- else:
- for tagged_tool in tag.tagged_tools:
- if tagged_tool.tool_id == tool.id:
- break
- else:
- tta = self.app.model.ToolTagAssociation( tool_id=tool.id, tag_id=tag.id )
- self.sa_session.add( tta )
- self.sa_session.flush()
- self.tools_by_id[ tool.id ] = tool
- key = 'tool_' + tool.id
- panel_dict[ key ] = tool
- log.debug( "Loaded tool: %s %s" % ( tool.id, tool.version ) )
- except:
- log.exception( "error reading tool from path: %s" % path )
- def load_workflow( elem, panel_dict ):
- try:
- # TODO: should id be encoded?
- workflow_id = elem.get( 'id' )
- workflow = self.load_workflow( workflow_id )
- self.workflows_by_id[ workflow_id ] = workflow
- key = 'workflow_' + workflow_id
- panel_dict[ key ] = workflow
- log.debug( "Loaded workflow: %s %s" % ( workflow_id, workflow.name ) )
- except:
- log.exception( "error loading workflow: %s" % workflow_id )
- def load_label( elem, panel_dict ):
- label = ToolSectionLabel( elem )
- key = 'label_' + label.id
- panel_dict[ key ] = label
- def load_section( elem, panel_dict ):
- section = ToolSection( elem )
- log.debug( "Loading section: %s" % section.name )
- for section_elem in elem:
- if section_elem.tag == 'tool':
- load_tool( section_elem, section.elems )
- elif section_elem.tag == 'workflow':
- load_workflow( section_elem, section.elems )
- elif section_elem.tag == 'label':
- load_label( section_elem, section.elems )
- key = 'section_' + section.id
- panel_dict[ key ] = section
-
if self.app.config.get_bool( 'enable_tool_tags', False ):
log.info("removing all tool tag associations (" + str( self.sa_session.query( self.app.model.ToolTagAssociation ).count() ) + ")")
self.sa_session.query( self.app.model.ToolTagAssociation ).delete()
self.sa_session.flush()
- log.info("parsing the tool configuration")
+ log.info( "parsing the tool configuration %s" % config_filename )
tree = util.parse_xml( config_filename )
root = tree.getroot()
+ tool_path = root.get( 'tool_path' )
+ if tool_path:
+ # We're parsing a shed_tool_conf file since we have a tool_path attribute.
+ self.shed_tool_confs[ config_filename ] = tool_path
+ else:
+ # Default to backward compatible config setting.
+ tool_path = self.tool_root_dir
for elem in root:
if elem.tag == 'tool':
- load_tool( elem, self.tool_panel )
+ self.load_tool_tag_set( elem, self.tool_panel, tool_path, guid=elem.get( 'guid' ) )
elif elem.tag == 'workflow':
- load_workflow( elem, self.tool_panel )
+ self.load_workflow_tag_set( elem, self.tool_panel )
elif elem.tag == 'section' :
- load_section( elem, self.tool_panel )
+ self.load_section_tag_set( elem, self.tool_panel, tool_path )
elif elem.tag == 'label':
- load_label( elem, self.tool_panel )
-
- def load_tool( self, config_file ):
+ self.load_label_tag_set( elem, self.tool_panel )
+ def load_tool_tag_set( self, elem, panel_dict, tool_path, guid=None ):
+ try:
+ path = elem.get( "file" )
+ tool = self.load_tool( os.path.join( tool_path, path ), guid=guid )
+ if self.app.config.get_bool( 'enable_tool_tags', False ):
+ tag_names = elem.get( "tags", "" ).split( "," )
+ for tag_name in tag_names:
+ if tag_name == '':
+ continue
+ tag = self.sa_session.query( self.app.model.Tag ).filter_by( name=tag_name ).first()
+ if not tag:
+ tag = self.app.model.Tag( name=tag_name )
+ self.sa_session.add( tag )
+ self.sa_session.flush()
+ tta = self.app.model.ToolTagAssociation( tool_id=tool.id, tag_id=tag.id )
+ self.sa_session.add( tta )
+ self.sa_session.flush()
+ else:
+ for tagged_tool in tag.tagged_tools:
+ if tagged_tool.tool_id == tool.id:
+ break
+ else:
+ tta = self.app.model.ToolTagAssociation( tool_id=tool.id, tag_id=tag.id )
+ self.sa_session.add( tta )
+ self.sa_session.flush()
+ if tool.id in self.tools_by_id:
+ raise Exception( "Tool with id %s already loaded." % tool.id )
+ else:
+ self.tools_by_id[ tool.id ] = tool
+ key = 'tool_' + tool.id
+ panel_dict[ key ] = tool
+ log.debug( "Loaded tool: %s %s" % ( tool.id, tool.version ) )
+ except:
+ log.exception( "error reading tool from path: %s" % path )
+ def load_workflow_tag_set( self, elem, panel_dict ):
+ try:
+ # TODO: should id be encoded?
+ workflow_id = elem.get( 'id' )
+ workflow = self.load_workflow( workflow_id )
+ self.workflows_by_id[ workflow_id ] = workflow
+ key = 'workflow_' + workflow_id
+ panel_dict[ key ] = workflow
+ log.debug( "Loaded workflow: %s %s" % ( workflow_id, workflow.name ) )
+ except:
+ log.exception( "error loading workflow: %s" % workflow_id )
+ def load_label_tag_set( self, elem, panel_dict ):
+ label = ToolSectionLabel( elem )
+ key = 'label_' + label.id
+ panel_dict[ key ] = label
+ def load_section_tag_set( self, elem, panel_dict, tool_path ):
+ key = 'section_' + elem.get( "id" )
+ if key in panel_dict:
+ # Appending a tool to an existing section in self.tool_panel
+ elems = panel_dict[ key ].elems
+ log.debug( "Appending to section: %s" % elem.get( "name" ) )
+ else:
+ # Appending a new section to self.tool_panel
+ section = ToolSection( elem )
+ elems = section.elems
+ log.debug( "Loading section: %s" % section.name )
+ for section_elem in elem:
+ if section_elem.tag == 'tool':
+ self.load_tool_tag_set( section_elem, elems, tool_path, guid=section_elem.get( 'guid' ) )
+ elif section_elem.tag == 'workflow':
+ self.load_workflow_tag_set( section_elem, elems )
+ elif section_elem.tag == 'label':
+ self.load_label_tag_set( section_elem, elems )
+ if key not in panel_dict:
+ panel_dict[ key ] = section
+ def load_tool( self, config_file, guid=None ):
"""
Load a single tool from the file named by `config_file` and return
an instance of `Tool`.
@@ -160,38 +182,43 @@
type_elem = root.find( "type" )
module = type_elem.get( 'module', 'galaxy.tools' )
cls = type_elem.get( 'class' )
- mod = __import__( module, globals(), locals(), [cls])
+ mod = __import__( module, globals(), locals(), [cls] )
ToolClass = getattr( mod, cls )
elif root.get( 'tool_type', None ) is not None:
ToolClass = tool_types.get( root.get( 'tool_type' ) )
else:
ToolClass = Tool
- return ToolClass( config_file, root, self.app )
-
- def reload( self, tool_id ):
+ return ToolClass( config_file, root, self.app, guid=guid )
+ def reload_tool_by_id( self, tool_id ):
"""
Attempt to reload the tool identified by 'tool_id', if successful
replace the old tool.
"""
if tool_id not in self.tools_by_id:
- raise ToolNotFoundException( "No tool with id %s" % tool_id )
- old_tool = self.tools_by_id[ tool_id ]
- new_tool = self.load_tool( old_tool.config_file )
- # Replace old_tool with new_tool in self.tool_panel
- tool_key = 'tool_' + tool_id
- for key, val in self.tool_panel.items():
- if key == tool_key:
- self.tool_panel[ key ] = new_tool
- break
- elif key.startswith( 'section' ):
- section = val
- for section_key, section_val in section.elems.items():
- if section_key == tool_key:
- self.tool_panel[ key ].elems[ section_key ] = new_tool
- break
- self.tools_by_id[ tool_id ] = new_tool
- log.debug( "Reloaded tool %s %s" %( old_tool.id, old_tool.version ) )
-
+ message = "No tool with id %s" % tool_id
+ status = 'error'
+ else:
+ old_tool = self.tools_by_id[ tool_id ]
+ new_tool = self.load_tool( old_tool.config_file )
+ # Replace old_tool with new_tool in self.tool_panel
+ tool_key = 'tool_' + tool_id
+ for key, val in self.tool_panel.items():
+ if key == tool_key:
+ self.tool_panel[ key ] = new_tool
+ break
+ elif key.startswith( 'section' ):
+ section = val
+ for section_key, section_val in section.elems.items():
+ if section_key == tool_key:
+ self.tool_panel[ key ].elems[ section_key ] = new_tool
+ break
+ self.tools_by_id[ tool_id ] = new_tool
+ message = "Reloaded the tool:<br/>"
+ message += "<b>name:</b> %s<br/>" % old_tool.name
+ message += "<b>id:</b> %s<br/>" % old_tool.id
+ message += "<b>version:</b> %s" % old_tool.version
+ status = 'done'
+ return message, status
def load_workflow( self, workflow_id ):
"""
Return an instance of 'Workflow' identified by `id`,
@@ -328,7 +355,7 @@
tool_type = 'default'
- def __init__( self, config_file, root, app ):
+ def __init__( self, config_file, root, app, guid=None ):
"""
Load a tool from the config named by `config_file`
"""
@@ -337,7 +364,7 @@
self.tool_dir = os.path.dirname( config_file )
self.app = app
# Parse XML element containing configuration
- self.parse( root )
+ self.parse( root, guid=guid )
@property
def sa_session( self ):
@@ -346,7 +373,7 @@
"""
return self.app.model.context
- def parse( self, root ):
+ def parse( self, root, guid=None ):
"""
Read tool configuration from the element `root` and fill in `self`.
"""
@@ -356,7 +383,10 @@
raise Exception, "Missing tool 'name'"
# Get the UNIQUE id for the tool
# TODO: can this be generated automatically?
- self.id = root.get( "id" )
+ if guid is not None:
+ self.id = guid
+ else:
+ self.id = root.get( "id" )
if not self.id:
raise Exception, "Missing tool 'id'"
self.version = root.get( "version" )
--- a/templates/admin/reload_tool.mako Fri Sep 02 14:37:09 2011 -0400
+++ b/templates/admin/reload_tool.mako Fri Sep 02 14:57:33 2011 -0400
@@ -8,7 +8,7 @@
<div class="toolForm"><div class="toolFormTitle">Reload Tool</div><div class="toolFormBody">
- <form name="tool_reload" action="${h.url_for( controller='admin', action='tool_reload' )}" method="post" >
+ <form name="reload_tool" id="reload_tool" action="${h.url_for( controller='admin', action='reload_tool' )}" method="post" ><div class="form-row"><label>
Tool to reload:
@@ -30,7 +30,7 @@
</select></div><div class="form-row">
- <input type="submit" name="action" value="Reload"/>
+ <input type="submit" name="reload_tool_button" value="Reload"/></div></form></div>
--- a/templates/tool_form.mako Fri Sep 02 14:37:09 2011 -0400
+++ b/templates/tool_form.mako Fri Sep 02 14:57:33 2011 -0400
@@ -260,7 +260,7 @@
%if tool.has_multiple_pages:
<div class="toolFormTitle">${tool.name} (step ${tool_state.page+1} of ${tool.npages})</div>
%else:
- <div class="toolFormTitle">${tool.name}</div>
+ <div class="toolFormTitle">${tool.name} (version ${tool.version})</div>
%endif
<div class="toolFormBody"><form id="tool_form" name="tool_form" action="${tool_url}" enctype="${tool.enctype}" target="${tool.target}" method="${tool.method}">
--- a/universe_wsgi.ini.sample Fri Sep 02 14:37:09 2011 -0400
+++ b/universe_wsgi.ini.sample Fri Sep 02 14:57:33 2011 -0400
@@ -123,10 +123,12 @@
# Temporary files are stored in this directory.
#new_file_path = database/tmp
-# Tool config file, defines what tools are available in Galaxy.
+# Tool config files, defines what tools are available in Galaxy.
+# Tools can be locally developed or installed from tool sheds.
#tool_config_file = tool_conf.xml
-# Path to the directory containing the tools defined in the config.
+# Default path to the directory containing the tools defined in tool_conf.xml.
+# Other tool config files must include the tool_path as an attribute in the <toolbox> tag.
#tool_path = tools
# Directory where data used by tools is located, see the samples in that
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
0