commit/galaxy-central: greg: Fix for setting tool shed repository etadata multiple times when nothing in the repository has changed.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/38899d79629b/
changeset: 38899d79629b
user: greg
date: 2011-07-11 20:48:12
summary: Fix for setting tool shed repository etadata multiple times when nothing in the repository has changed.
affected #: 1 file (178 bytes)
--- a/lib/galaxy/webapps/community/controllers/common.py Mon Jul 11 14:10:56 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Mon Jul 11 14:48:12 2011 -0400
@@ -146,10 +146,13 @@
metadata_dict[ 'tools' ] = [ tool_dict ]
except Exception, e:
invalid_tool_configs.append( ( name, str( e ) ) )
- repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
- trans.sa_session.add( repository_metadata )
- if not flush_needed:
- flush_needed = True
+ if metadata_dict:
+ # The metadata_dict dictionary will contain items only
+ # if the repository did not already have metadata set.
+ repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
+ trans.sa_session.add( repository_metadata )
+ if not flush_needed:
+ flush_needed = True
else:
message = "Repository does not include changeset revision '%s'." % str( ctx_str )
status = 'error'
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.
10 years, 11 months
commit/galaxy-central: greg: Bug fix for setting tool shed repository metadata on repositories containing more than 1 tool.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/6e9fca39e3f4/
changeset: 6e9fca39e3f4
user: greg
date: 2011-07-11 20:10:56
summary: Bug fix for setting tool shed repository metadata on repositories containing more than 1 tool.
affected #: 1 file (106 bytes)
--- a/lib/galaxy/webapps/community/controllers/common.py Mon Jul 11 13:45:57 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Mon Jul 11 14:10:56 2011 -0400
@@ -86,6 +86,7 @@
invalid_tool_configs = []
flush_needed = False
if change_set is not None:
+ metadata_dict = {}
for root, dirs, files in os.walk( repo_dir ):
if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
if '.hg' in dirs:
@@ -139,13 +140,16 @@
if not flush_needed:
flush_needed = True
else:
- metadata_dict = dict( tools = [ tool_dict ] )
- repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
- trans.sa_session.add( repository_metadata )
- if not flush_needed:
- flush_needed = True
+ if 'tools' in metadata_dict:
+ metadata_dict[ 'tools' ].append( tool_dict )
+ else:
+ metadata_dict[ 'tools' ] = [ tool_dict ]
except Exception, e:
invalid_tool_configs.append( ( name, str( e ) ) )
+ repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
+ trans.sa_session.add( repository_metadata )
+ if not flush_needed:
+ flush_needed = True
else:
message = "Repository does not include changeset revision '%s'." % str( ctx_str )
status = 'error'
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.
10 years, 11 months
commit/galaxy-central: greg: Allow an admin user to manage repositories they do not own.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/0007cf69d1dc/
changeset: 0007cf69d1dc
user: greg
date: 2011-07-11 19:45:57
summary: Allow an admin user to manage repositories they do not own.
affected #: 1 file (61 bytes)
--- a/lib/galaxy/webapps/community/controllers/repository.py Mon Jul 11 13:34:23 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Mon Jul 11 13:45:57 2011 -0400
@@ -214,7 +214,8 @@
if operation == "view_or_manage_repository":
repository_id = kwd.get( 'id', None )
repository = get_repository( trans, repository_id )
- if repository.user == trans.user:
+ is_admin = trans.user_is_admin()
+ if is_admin or repository.user == trans.user:
return trans.response.send_redirect( web.url_for( controller='repository',
action='manage_repository',
**kwd ) )
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.
10 years, 11 months
commit/galaxy-central: greg: Do not set tool shed repository metadata if tool does not load. Add tool config <requirements> settings to tool shed repository metadata.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/34c190323b36/
changeset: 34c190323b36
user: greg
date: 2011-07-11 19:34:23
summary: Do not set tool shed repository metadata if tool does not load. Add tool config <requirements> settings to tool shed repository metadata.
affected #: 5 files (4.3 KB)
--- a/lib/galaxy/webapps/community/controllers/common.py Fri Jul 08 16:11:28 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Mon Jul 11 13:34:23 2011 -0400
@@ -75,9 +75,100 @@
.filter( and_( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ),
trans.model.RepositoryMetadata.table.c.changeset_revision == changeset_revision ) ) \
.first()
+def set_repository_metadata( trans, id, ctx_str, **kwd ):
+ """Set repository metadata"""
+ message = ''
+ status = 'done'
+ repository = get_repository( trans, id )
+ repo_dir = repository.repo_path
+ repo = hg.repository( ui.ui(), repo_dir )
+ change_set = get_change_set( trans, repo, ctx_str )
+ invalid_tool_configs = []
+ flush_needed = False
+ if change_set is not None:
+ for root, dirs, files in os.walk( repo_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' ):
+ try:
+ full_path = os.path.abspath( os.path.join( root, name ) )
+ tool = load_tool( trans, full_path )
+ if tool is not None:
+ repository_metadata = get_repository_metadata( trans, id, repository.tip )
+ tool_requirements = []
+ for tr in tool.requirements:
+ requirement_dict = dict( name=tr.name,
+ type=tr.type,
+ version=tr.version )
+ tool_requirements.append( requirement_dict )
+ tool_dict = dict( id = tool.id,
+ name = tool.name,
+ version = tool.version,
+ description = tool.description,
+ tool_config = os.path.join( root, name ),
+ requirements = tool_requirements )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata and 'tools' in metadata:
+ metadata_tools = metadata[ 'tools' ]
+ found = False
+ for tool_metadata_dict in metadata_tools:
+ if 'id' in tool_metadata_dict and tool_metadata_dict[ 'id' ] == tool.id and \
+ 'version' in tool_metadata_dict and tool_metadata_dict[ 'version' ] == tool.version:
+ found = True
+ tool_metadata_dict[ 'name' ] = tool.name
+ tool_metadata_dict[ 'description' ] = tool.description
+ tool_metadata_dict[ 'tool_config' ] = os.path.join( root, name )
+ tool_metadata_dict[ 'requirements' ] = tool_requirements
+ flush_needed = True
+ if not found:
+ metadata_tools.append( tool_dict )
+ else:
+ if metadata is None:
+ repository_metadata.metadata = {}
+ repository_metadata.metadata[ 'tools' ] = [ tool_dict ]
+ trans.sa_session.add( repository_metadata )
+ if not flush_needed:
+ flush_needed = True
+ else:
+ metadata_dict = dict( tools = [ tool_dict ] )
+ repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
+ trans.sa_session.add( repository_metadata )
+ if not flush_needed:
+ flush_needed = True
+ except Exception, e:
+ invalid_tool_configs.append( ( name, str( e ) ) )
+ else:
+ message = "Repository does not include changeset revision '%s'." % str( ctx_str )
+ status = 'error'
+ if invalid_tool_configs:
+ message = "Metadata cannot be defined for change set revision '%s'. Correct the following problems and reset metadata.<br/>" % str( ctx_str )
+ for itc_tup in invalid_tool_configs:
+ message += "<b>%s</b> - %s<br/>" % ( itc_tup[0], itc_tup[1] )
+ status = 'error'
+ elif flush_needed:
+ # We only flush if there are no tool config errors, so change sets will only have metadata
+ # if everything in them is valid.
+ trans.sa_session.flush()
+ return message, status
def get_repository_by_name( trans, name ):
"""Get a repository from the database via name"""
return trans.sa_session.query( app.model.Repository ).filter_by( name=name ).one()
+def get_change_set( trans, repo, ctx_str, **kwd ):
+ """Retrieve a specified change set from a repository"""
+ for changeset in repo.changelog:
+ ctx = repo.changectx( changeset )
+ if str( ctx ) == ctx_str:
+ return ctx
+ return None
def get_user( trans, id ):
"""Get a user from the database"""
return trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( id ) )
@@ -184,77 +275,3 @@
ToolClass = Tool
return ToolClass( config_file, root, trans.app )
return None
-def set_repository_metadata( trans, id, ctx_str, **kwd ):
- """Set repository metadata"""
- message = ''
- status = 'done'
- repository = get_repository( trans, id )
- repo_dir = repository.repo_path
- repo = hg.repository( ui.ui(), repo_dir )
- found = False
- invalid_tool_configs = []
- for changeset in repo.changelog:
- ctx = repo.changectx( changeset )
- if str( ctx ) == ctx_str:
- found = True
- break
- if found:
- for root, dirs, files in os.walk( repo_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' ):
- try:
- full_path = os.path.abspath( os.path.join( root, name ) )
- tool = load_tool( trans, full_path )
- if tool is not None:
- repository_metadata = get_repository_metadata( trans, id, repository.tip )
- # TODO: add more stuff, like requirements
- tool_dict = dict( id = tool.id,
- name = tool.name,
- version = tool.version,
- description = tool.description,
- tool_config = full_path )
- if repository_metadata:
- metadata = repository_metadata.metadata
- if metadata and 'tools' in metadata:
- metadata_tools = metadata[ 'tools' ]
- found = False
- for tool_metadata_dict in metadata_tools:
- if 'id' in tool_metadata_dict and tool_metadata_dict[ 'id' ] == tool.id and \
- 'version' in tool_metadata_dict and tool_metadata_dict[ 'version' ] == tool.version:
- found = True
- tool_metadata_dict[ 'name' ] = tool.name
- tool_metadata_dict[ 'description' ] = tool.description
- tool_metadata_dict[ 'tool_config' ] = os.path.join( root, name )
- # TODO: add more stuff, like tool requirements, code files, etc
- if not found:
- metadata_tools.append( tool_dict )
- else:
- if metadata is None:
- repository_metadata.metadata = {}
- repository_metadata.metadata[ 'tools' ] = [ tool_dict ]
- trans.sa_session.add( repository_metadata )
- else:
- metadata_dict = dict( tools = [ tool_dict ] )
- repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
- trans.sa_session.add( repository_metadata )
- trans.sa_session.flush()
- except Exception, e:
- invalid_tool_configs.append( ( name, str( e ) ) )
- else:
- message = "Repository does not include changeset revision '%s'." % str( ctx_str )
- status = 'error'
- if invalid_tool_configs:
- message = "The following tool configs are invalid and were not added to the repository metadata:<br/>"
- for itc_tup in invalid_tool_configs:
- message += "<b>%s</b> - %s<br/>" % ( itc_tup[0], itc_tup[1] )
- status = 'error'
- return message, status
--- a/lib/galaxy/webapps/community/controllers/repository.py Fri Jul 08 16:11:28 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Mon Jul 11 13:34:23 2011 -0400
@@ -643,13 +643,8 @@
status = params.get( 'status', 'done' )
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
- found = False
- for changeset in repo.changelog:
- ctx = repo.changectx( changeset )
- if str( ctx ) == ctx_str:
- found = True
- break
- if not found:
+ ctx = get_change_set( trans, repo, ctx_str )
+ if ctx is None:
message = "Repository does not include changeset revision '%s'." % str( ctx_str )
status = 'error'
return trans.response.send_redirect( web.url_for( controller='repository',
@@ -753,6 +748,8 @@
@web.require_login( "set repository metadata" )
def set_metadata( self, trans, id, ctx_str, **kwd ):
message, status = set_repository_metadata( trans, id, ctx_str, **kwd )
+ if not message:
+ message = "Metadata for change set revision '%s' has been reset." % str( ctx_str )
return trans.response.send_redirect( web.url_for( controller='repository',
action='manage_repository',
id=id,
--- a/templates/webapps/community/repository/manage_repository.mako Fri Jul 08 16:11:28 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Mon Jul 11 13:34:23 2011 -0400
@@ -160,11 +160,36 @@
<label>Tools:</label><% 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><a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}">${tool_dict[ 'name' ]}</a></td><td>${tool_dict[ 'description' ]}</td>
- <td>version: ${tool_dict[ 'version' ]}</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>
--- a/templates/webapps/community/repository/tool_form.mako Fri Jul 08 16:11:28 2011 -0400
+++ b/templates/webapps/community/repository/tool_form.mako Mon Jul 11 13:34:23 2011 -0400
@@ -15,6 +15,10 @@
can_rate = trans.user and repository.user != trans.user
can_manage = is_admin or repository.user == trans.user
can_view_change_log = not is_new
+ if can_push:
+ browse_label = 'Browse or delete repository files'
+ else:
+ browse_label = 'Browse repository files'
%><html>
@@ -116,6 +120,9 @@
%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
--- a/templates/webapps/community/repository/view_repository.mako Fri Jul 08 16:11:28 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Mon Jul 11 13:34:23 2011 -0400
@@ -155,11 +155,36 @@
<label>Tools:</label><% 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><a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}">${tool_dict[ 'name' ]}</a></td><td>${tool_dict[ 'description' ]}</td><td>version: ${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>
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.
10 years, 11 months
commit/galaxy-central: greg: First pass implementation for tool shed repository metadata. This implementation currently provides a baseline metadata collection for tools in a tool shed repository. This change set also includes the implementation for displaying a tool UI for each valid tool config in the tool shed repository. Fixes issue # 565.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/8b97f197b759/
changeset: 8b97f197b759
user: greg
date: 2011-07-08 22:11:28
summary: First pass implementation for tool shed repository metadata. This implementation currently provides a baseline metadata collection for tools in a tool shed repository. This change set also includes the implementation for displaying a tool UI for each valid tool config in the tool shed repository. Fixes issue # 565.
affected #: 16 files (14.8 KB)
--- a/lib/galaxy/webapps/community/app.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/app.py Fri Jul 08 16:11:28 2011 -0400
@@ -1,4 +1,6 @@
import sys, config
+import galaxy.tools.data
+import galaxy.datatypes.registry
import galaxy.webapps.community.model
from galaxy.web import security
from galaxy.tags.tag_handler import CommunityTagHandler
@@ -11,6 +13,8 @@
self.config = config.Configuration( **kwargs )
self.config.check()
config.configure_logging( self.config )
+ # Set up datatypes registry
+ self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config )
# Determine the database url
if self.config.database_connection:
db_url = self.config.database_connection
@@ -28,6 +32,8 @@
self.security = security.SecurityHelper( id_secret=self.config.id_secret )
# Tag handler
self.tag_handler = CommunityTagHandler()
+ # Tool data tables
+ self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_table_config_path )
# Load security policy
self.security_agent = self.model.security_agent
def shutdown( self ):
--- a/lib/galaxy/webapps/community/config.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/config.py Fri Jul 08 16:11:28 2011 -0400
@@ -41,6 +41,9 @@
self.cookie_path = kwargs.get( "cookie_path", "/" )
self.test_conf = resolve_path( kwargs.get( "test_conf", "" ), self.root )
self.id_secret = kwargs.get( "id_secret", "USING THE DEFAULT IS NOT SECURE!" )
+ self.tool_secret = kwargs.get( "tool_secret", "" )
+ self.tool_data_path = resolve_path( kwargs.get( "tool_data_path", "tool-data" ), os.getcwd() )
+ self.tool_data_table_config_path = resolve_path( kwargs.get( 'tool_data_table_config_path', 'tool_data_table_conf.xml' ), self.root )
self.use_remote_user = string_as_bool( kwargs.get( "use_remote_user", "False" ) )
self.remote_user_maildomain = kwargs.get( "remote_user_maildomain", None )
self.remote_user_logout_href = kwargs.get( "remote_user_logout_href", None )
@@ -56,7 +59,9 @@
self.smtp_server = kwargs.get( 'smtp_server', None )
self.smtp_username = kwargs.get( 'smtp_username', None )
self.smtp_password = kwargs.get( 'smtp_password', None )
+ self.start_job_runners = kwargs.get( 'start_job_runners', None )
self.email_alerts_from = kwargs.get( 'email_alerts_from', None )
+ self.nginx_upload_path = kwargs.get( 'nginx_upload_path', False )
self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) )
self.brand = kwargs.get( 'brand', None )
self.wiki_url = kwargs.get( 'wiki_url', 'http://bitbucket.org/galaxy/galaxy-central/wiki/Home' )
@@ -65,7 +70,7 @@
self.screencasts_url = kwargs.get( 'screencasts_url', None )
self.log_events = False
self.cloud_controller_instance = False
- self.datatypes_config = kwargs.get( 'datatypes_config_file', 'community_datatypes_conf.xml' )
+ self.datatypes_config = kwargs.get( 'datatypes_config_file', 'datatypes_conf.xml' )
# Proxy features
self.apache_xsendfile = kwargs.get( 'apache_xsendfile', False )
self.nginx_x_accel_redirect_base = kwargs.get( 'nginx_x_accel_redirect_base', False )
--- a/lib/galaxy/webapps/community/controllers/common.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Fri Jul 08 16:11:28 2011 -0400
@@ -1,12 +1,13 @@
import os, string, socket, logging
from time import strftime
from datetime import *
+from galaxy.tools import *
from galaxy.util.json import from_json_string, to_json_string
from galaxy.web.base.controller import *
from galaxy.webapps.community import model
from galaxy.model.orm import *
from galaxy.model.item_attrs import UsesItemRatings
-from mercurial import hg, ui
+from mercurial import hg, ui, commands
log = logging.getLogger( __name__ )
@@ -68,14 +69,15 @@
def get_repository( trans, id ):
"""Get a repository from the database via id"""
return trans.sa_session.query( trans.model.Repository ).get( trans.security.decode_id( id ) )
+def get_repository_metadata( trans, id, changeset_revision ):
+ """Get metadata for a specified repository change set from the database"""
+ return trans.sa_session.query( trans.model.RepositoryMetadata ) \
+ .filter( and_( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ),
+ trans.model.RepositoryMetadata.table.c.changeset_revision == changeset_revision ) ) \
+ .first()
def get_repository_by_name( trans, name ):
"""Get a repository from the database via name"""
return trans.sa_session.query( app.model.Repository ).filter_by( name=name ).one()
-def get_repository_tip( repository ):
- # The received repository must be a mercurial repository, not a db record.
- tip_changeset = repository.changelog.tip()
- tip_ctx = repository.changectx( tip_changeset )
- return "%s:%s" % ( str( tip_ctx.rev() ), tip_ctx.parents()[0] )
def get_user( trans, id ):
"""Get a user from the database"""
return trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( id ) )
@@ -121,19 +123,138 @@
def update_for_browsing( repository, current_working_dir ):
# Make a copy of a repository's files for browsing.
repo_dir = repository.repo_path
+ repo = hg.repository( ui.ui(), repo_dir )
+ # The following will delete the disk copy of only the files in the repository.
+ #os.system( 'hg update -r null > /dev/null 2>&1' )
+ repo.ui.pushbuffer()
+ commands.status( repo.ui, repo, all=True )
+ status_and_file_names = repo.ui.popbuffer().strip().split( "\n" )
+ # status_and_file_names looks something like:
+ # ['? MY_README_AGAIN', '? galaxy_tmap_tool/tmap-0.0.9.tar.gz', '? dna_filtering.py', 'C filtering.py', 'C filtering.xml']
+ # The codes used to show the status of files are:
+ # M = modified
+ # A = added
+ # R = removed
+ # C = clean
+ # ! = deleted, but still tracked
+ # ? = not tracked
+ # I = ignored
+ # We'll remove all files that are not tracked or ignored.
+ files_to_remove_from_disk = []
+ for status_and_file_name in status_and_file_names:
+ if status_and_file_name.startswith( '?' ) or status_and_file_name.startswith( 'I' ):
+ files_to_remove_from_disk.append( os.path.abspath( os.path.join( repo_dir, status_and_file_name.split()[1] ) ) )
+ for full_path in files_to_remove_from_disk:
+ if os.path.isdir( full_path ):
+ try:
+ os.rmdir( full_path )
+ except OSError, e:
+ # The directory is not empty
+ pass
+ elif os.path.isfile( full_path ):
+ os.remove( full_path )
+ dir = os.path.split( full_path )[0]
+ try:
+ os.rmdir( dir )
+ except OSError, e:
+ # The directory is not empty
+ pass
os.chdir( repo_dir )
os.system( 'hg update > /dev/null 2>&1' )
os.chdir( current_working_dir )
+def load_tool( trans, config_file ):
"""
- # TODO: the following is useful if the repository files somehow include missing or
- # untracked files. If this happens, we can enhance the following to clean things up.
- # We're not currently doing any cleanup though since so far none of the repositories
- # have problematic files for browsing.
- # Get the tip change set.
+ Load a single tool from the file named by `config_file` and return
+ an instance of `Tool`.
+ """
+ # Parse XML configuration file and get the root element
+ tree = util.parse_xml( config_file )
+ root = tree.getroot()
+ if root.tag == 'tool':
+ # Allow specifying a different tool subclass to instantiate
+ if root.find( "type" ) is not None:
+ type_elem = root.find( "type" )
+ module = type_elem.get( 'module', 'galaxy.tools' )
+ cls = type_elem.get( 'class' )
+ 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, trans.app )
+ return None
+def set_repository_metadata( trans, id, ctx_str, **kwd ):
+ """Set repository metadata"""
+ message = ''
+ status = 'done'
+ repository = get_repository( trans, id )
+ repo_dir = repository.repo_path
repo = hg.repository( ui.ui(), repo_dir )
+ found = False
+ invalid_tool_configs = []
for changeset in repo.changelog:
ctx = repo.changectx( changeset )
- ctx_parent = ctx.parents()[0]
- break
- modified, added, removed, deleted, unknown, ignored, clean = repo.status( node1=ctx_parent.node(), node2=ctx.node() )
- """
+ if str( ctx ) == ctx_str:
+ found = True
+ break
+ if found:
+ for root, dirs, files in os.walk( repo_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' ):
+ try:
+ full_path = os.path.abspath( os.path.join( root, name ) )
+ tool = load_tool( trans, full_path )
+ if tool is not None:
+ repository_metadata = get_repository_metadata( trans, id, repository.tip )
+ # TODO: add more stuff, like requirements
+ tool_dict = dict( id = tool.id,
+ name = tool.name,
+ version = tool.version,
+ description = tool.description,
+ tool_config = full_path )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ if metadata and 'tools' in metadata:
+ metadata_tools = metadata[ 'tools' ]
+ found = False
+ for tool_metadata_dict in metadata_tools:
+ if 'id' in tool_metadata_dict and tool_metadata_dict[ 'id' ] == tool.id and \
+ 'version' in tool_metadata_dict and tool_metadata_dict[ 'version' ] == tool.version:
+ found = True
+ tool_metadata_dict[ 'name' ] = tool.name
+ tool_metadata_dict[ 'description' ] = tool.description
+ tool_metadata_dict[ 'tool_config' ] = os.path.join( root, name )
+ # TODO: add more stuff, like tool requirements, code files, etc
+ if not found:
+ metadata_tools.append( tool_dict )
+ else:
+ if metadata is None:
+ repository_metadata.metadata = {}
+ repository_metadata.metadata[ 'tools' ] = [ tool_dict ]
+ trans.sa_session.add( repository_metadata )
+ else:
+ metadata_dict = dict( tools = [ tool_dict ] )
+ repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
+ trans.sa_session.add( repository_metadata )
+ trans.sa_session.flush()
+ except Exception, e:
+ invalid_tool_configs.append( ( name, str( e ) ) )
+ else:
+ message = "Repository does not include changeset revision '%s'." % str( ctx_str )
+ status = 'error'
+ if invalid_tool_configs:
+ message = "The following tool configs are invalid and were not added to the repository metadata:<br/>"
+ for itc_tup in invalid_tool_configs:
+ message += "<b>%s</b> - %s<br/>" % ( itc_tup[0], itc_tup[1] )
+ status = 'error'
+ return message, status
--- a/lib/galaxy/webapps/community/controllers/repository.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Fri Jul 08 16:11:28 2011 -0400
@@ -76,8 +76,7 @@
return repository.name
class VersionColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository ):
- repo = hg.repository( ui.ui(), repository.repo_path )
- return get_repository_tip( repo )
+ return repository.version
class DescriptionColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository ):
return repository.description
@@ -124,7 +123,7 @@
key="name",
link=( lambda item: dict( operation="view_or_manage_repository", id=item.id, webapp="community" ) ),
attach_popup=False ),
- DescriptionColumn( "Description",
+ DescriptionColumn( "Synopsis",
key="description",
attach_popup=False ),
VersionColumn( "Version",
@@ -420,7 +419,7 @@
selected_files_to_delete = selected_files_to_delete.split( ',' )
current_working_dir = os.getcwd()
# Get the current repository tip.
- tip = repo[ 'tip' ]
+ tip = repository.tip
for selected_file in selected_files_to_delete:
repo_file = os.path.abspath( selected_file )
commands.remove( repo.ui, repo, repo_file )
@@ -434,10 +433,19 @@
update_for_browsing( repository, current_working_dir )
# Get the new repository tip.
repo = hg.repository( ui.ui(), repo_dir )
- if tip != repo[ 'tip' ]:
+ if tip != repository.tip:
message = "The selected files were deleted from the repository."
else:
message = 'No changes to repository.'
+ # Set metadata on the repository tip
+ error_message, status = set_repository_metadata( trans, id, repository.tip, **kwd )
+ if error_message:
+ message = '%s<br/>%s' % ( message, error_message )
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='manage_repository',
+ id=id,
+ message=message,
+ status=status ) )
else:
message = "Select at least 1 file to delete from the repository before clicking <b>Delete selected files</b>."
status = "error"
@@ -454,7 +462,6 @@
status = params.get( 'status', 'done' )
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
- tip = get_repository_tip( repo )
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) )
alerts = params.get( 'alerts', '' )
@@ -481,10 +488,15 @@
trans.sa_session.flush()
checked = alerts_checked or ( user and user.email in email_alerts )
alerts_check_box = CheckboxField( 'alerts', checked=checked )
+ repository_metadata = get_repository_metadata( trans, id, repository.tip )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ else:
+ metadata = None
return trans.fill_template( '/webapps/community/repository/view_repository.mako',
repo=repo,
repository=repository,
- tip=tip,
+ metadata=metadata,
avg_rating=avg_rating,
display_reviews=display_reviews,
num_ratings=num_ratings,
@@ -499,7 +511,6 @@
status = params.get( 'status', 'done' )
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
- tip = get_repository_tip( repo )
repo_name = util.restore_text( params.get( 'repo_name', repository.name ) )
description = util.restore_text( params.get( 'description', repository.description ) )
long_description = util.restore_text( params.get( 'long_description', repository.long_description ) )
@@ -577,6 +588,11 @@
allow_push_select_field = self.__build_allow_push_select_field( trans, current_allow_push_list )
checked = alerts_checked or user.email in email_alerts
alerts_check_box = CheckboxField( 'alerts', checked=checked )
+ repository_metadata = get_repository_metadata( trans, id, repository.tip )
+ if repository_metadata:
+ metadata = repository_metadata.metadata
+ else:
+ metadata = None
return trans.fill_template( '/webapps/community/repository/manage_repository.mako',
repo_name=repo_name,
description=description,
@@ -585,7 +601,7 @@
allow_push_select_field=allow_push_select_field,
repo=repo,
repository=repository,
- tip=tip,
+ metadata=metadata,
avg_rating=avg_rating,
display_reviews=display_reviews,
num_ratings=num_ratings,
@@ -676,7 +692,6 @@
status='error' ) )
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
- tip = get_repository_tip( repo )
if repository.user == trans.user:
return trans.response.send_redirect( web.url_for( controller='repository',
action='browse_repositories',
@@ -691,7 +706,6 @@
rra = self.get_user_item_rating( trans.sa_session, trans.user, repository, webapp_model=trans.model )
return trans.fill_template( '/webapps/community/repository/rate_repository.mako',
repository=repository,
- tip=tip,
avg_rating=avg_rating,
display_reviews=display_reviews,
num_ratings=num_ratings,
@@ -736,6 +750,40 @@
action='browse_repositories',
**kwd ) )
@web.expose
+ @web.require_login( "set repository metadata" )
+ def set_metadata( self, trans, id, ctx_str, **kwd ):
+ message, status = set_repository_metadata( trans, id, ctx_str, **kwd )
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='manage_repository',
+ id=id,
+ message=message,
+ status=status ) )
+ @web.expose
+ def display_tool( self, trans, repository_id, tool_config, **kwd ):
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
+ repository = get_repository( trans, repository_id )
+ tool = load_tool( trans, os.path.abspath( tool_config ) )
+ tool_state = self.__new_state( trans )
+ return trans.fill_template( "/webapps/community/repository/tool_form.mako",
+ repository=repository,
+ tool=tool,
+ tool_state=tool_state,
+ message=message,
+ status=status )
+ def __new_state( self, trans, all_pages=False ):
+ """
+ Create a new `DefaultToolState` for this tool. It will not be initialized
+ with default values for inputs.
+
+ Only inputs on the first page will be initialized unless `all_pages` is
+ True, in which case all inputs regardless of page are initialized.
+ """
+ state = DefaultToolState()
+ state.inputs = {}
+ return state
+ @web.expose
def download( self, trans, repository_id, file_type, **kwd ):
# Download an archive of the repository files compressed as zip, gz or bz2.
params = util.Params( kwd )
--- a/lib/galaxy/webapps/community/controllers/upload.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Fri Jul 08 16:11:28 2011 -0400
@@ -33,7 +33,7 @@
uploaded_file = None
upload_point = self.__get_upload_point( repository, **kwd )
# Get the current repository tip.
- tip = repo[ 'tip' ]
+ tip = repository.tip
if params.get( 'upload_button', False ):
current_working_dir = os.getcwd()
file_data = params.get( 'file_data', '' )
@@ -89,8 +89,7 @@
# is eliminating unwanted files from the repository directory.
update_for_browsing( repository, current_working_dir )
# Get the new repository tip.
- repo = hg.repository( ui.ui(), repo_dir )
- if tip != repo[ 'tip' ]:
+ if tip != repository.tip:
if ( isgzip or isbz2 ) and uncompress_file:
uncompress_str = ' uncompressed and '
else:
@@ -102,12 +101,22 @@
else:
message += " %d files were removed from the repository root." % len( files_to_remove )
else:
- message = 'No changes to repository.'
+ message = 'No changes to repository.'
+ # Set metadata on the repository tip
+ error_message, status = set_repository_metadata( trans, repository_id, repository.tip, **kwd )
+ if error_message:
+ message = '%s<br/>%s' % ( message, error_message )
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='manage_repository',
+ id=repository_id,
+ message=message,
+ status=status ) )
trans.response.send_redirect( web.url_for( controller='repository',
action='browse_repository',
+ id=repository_id,
commit_message='Deleted selected files',
message=message,
- id=trans.security.encode_id( repository.id ) ) )
+ status=status ) )
else:
status = 'error'
selected_categories = [ trans.security.decode_id( id ) for id in category_ids ]
--- a/lib/galaxy/webapps/community/model/__init__.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/model/__init__.py Fri Jul 08 16:11:28 2011 -0400
@@ -114,6 +114,15 @@
return config.get( "paths", option )
raise Exception( "Entry for repository %s missing in %s/hgweb.config file." % ( lhs, os.getcwd() ) )
@property
+ def version( self ):
+ repo = hg.repository( ui.ui(), self.repo_path )
+ tip_ctx = repo.changectx( repo.changelog.tip() )
+ return "%s:%s" % ( str( tip_ctx.rev() ), str( repo.changectx( repo.changelog.tip() ) ) )
+ @property
+ def tip( self ):
+ repo = hg.repository( ui.ui(), self.repo_path )
+ return str( repo.changectx( repo.changelog.tip() ) )
+ @property
def is_new( self ):
repo = hg.repository( ui.ui(), self.repo_path )
tip_ctx = repo.changectx( repo.changelog.tip() )
@@ -143,6 +152,12 @@
fp.write( line )
fp.close()
+class RepositoryMetadata( object ):
+ def __init__( self, repository_id=None, changeset_revision=None, metadata=None ):
+ self.repository_id = repository_id
+ self.changeset_revision = changeset_revision
+ self.metadata = metadata or dict()
+
class ItemRatingAssociation( object ):
def __init__( self, id=None, user=None, item=None, rating=0, comment='' ):
self.id = id
--- a/lib/galaxy/webapps/community/model/mapping.py Fri Jul 08 09:09:02 2011 -0400
+++ b/lib/galaxy/webapps/community/model/mapping.py Fri Jul 08 16:11:28 2011 -0400
@@ -111,6 +111,14 @@
Column( "email_alerts", JSONType, nullable=True ),
Column( "times_downloaded", Integer ) )
+RepositoryMetadata.table = Table( "repository_metadata", metadata,
+ Column( "id", Integer, primary_key=True ),
+ Column( "create_time", DateTime, default=now ),
+ Column( "update_time", DateTime, default=now, onupdate=now ),
+ Column( "repository_id", Integer, ForeignKey( "repository.id" ), index=True ),
+ Column( "changeset_revision", TrimmedString( 255 ), index=True ),
+ Column( "metadata", JSONType, nullable=True ) )
+
RepositoryRatingAssociation.table = Table( "repository_rating_association", metadata,
Column( "id", Integer, primary_key=True ),
Column( "create_time", DateTime, default=now ),
@@ -186,6 +194,9 @@
ratings=relation( RepositoryRatingAssociation, order_by=desc( RepositoryRatingAssociation.table.c.update_time ), backref="repositories" ),
user=relation( User.mapper ) ) )
+assign_mapper( context, RepositoryMetadata, RepositoryMetadata.table,
+ properties=dict( repository=relation( Repository ) ) )
+
assign_mapper( context, RepositoryRatingAssociation, RepositoryRatingAssociation.table,
properties=dict( repository=relation( Repository ), user=relation( User ) ) )
--- a/templates/webapps/community/repository/browse_repository.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/browse_repository.mako Fri Jul 08 16:11:28 2011 -0400
@@ -5,12 +5,13 @@
<%
from galaxy.web.framework.helpers import time_ago
+ is_admin = trans.user_is_admin()
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
can_browse_contents = not is_new
can_rate = trans.user and repository.user != trans.user
- can_manage = repository.user == trans.user
+ can_manage = is_admin or repository.user == trans.user
can_view_change_log = not is_new
%>
--- a/templates/webapps/community/repository/manage_repository.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Fri Jul 08 16:11:28 2011 -0400
@@ -121,9 +121,9 @@
<div class="form-row"><label>Version:</label>
%if can_view_change_log:
- <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${tip}</a>
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${repository.version}</a>
%else:
- ${tip}
+ ${repository.version}
%endif
</div><div class="form-row">
@@ -150,6 +150,40 @@
</form></div></div>
+<p/>
+<div class="toolForm">
+ <div class="toolFormTitle">Repository metadata</div>
+ <div class="toolFormBody">
+ %if metadata:
+ %if 'tools' in metadata:
+ <div class="form-row">
+ <label>Tools:</label>
+ <% tool_dicts = metadata[ 'tools' ] %>
+ <table class="grid">
+ %for tool_dict in tool_dicts:
+ <tr>
+ <td><a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}">${tool_dict[ 'name' ]}</a></td>
+ <td>${tool_dict[ 'description' ]}</td>
+ <td>version: ${tool_dict[ 'version' ]}</td>
+ </tr>
+ %endfor
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ %endif
+ %endif
+ <form name="set_metadata" action="${h.url_for( controller='repository', action='set_metadata', id=trans.security.encode_id( repository.id ), ctx_str=repository.tip )}" 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>
+ </div>
+</div>
%if trans.app.config.smtp_server:
<p/><div class="toolForm">
--- a/templates/webapps/community/repository/rate_repository.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/rate_repository.mako Fri Jul 08 16:11:28 2011 -0400
@@ -4,12 +4,13 @@
<%
from galaxy.web.framework.helpers import time_ago
from urllib import quote_plus
+ is_admin = trans.user_is_admin()
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
can_browse_contents = not is_new
can_rate = repository.user != trans.user
- can_manage = repository.user == trans.user
+ can_manage = is_admin or repository.user == trans.user
can_view_change_log = not is_new
if can_push:
browse_label = 'Browse or delete repository files'
@@ -103,7 +104,7 @@
</div><div class="form-row"><label>Version:</label>
- ${tip}
+ ${repository.version}
<div style="clear: both"></div></div><div class="form-row">
--- a/templates/webapps/community/repository/upload.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/upload.mako Fri Jul 08 16:11:28 2011 -0400
@@ -2,11 +2,12 @@
<%namespace file="/webapps/community/repository/common.mako" import="*" /><%
+ is_admin = trans.user_is_admin()
is_new = repository.is_new
can_browse_contents = not is_new
can_browse_contents = not is_new
can_rate = repository.user != trans.user
- can_manage = repository.user == trans.user
+ can_manage = is_admin or repository.user == trans.user
can_view_change_log = not is_new
%>
--- a/templates/webapps/community/repository/view_changelog.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/view_changelog.mako Fri Jul 08 16:11:28 2011 -0400
@@ -5,9 +5,10 @@
<%
from galaxy.web.framework.helpers import time_ago
+ is_admin = trans.user_is_admin()
is_new = repository.is_new
can_browse_contents = not is_new
- can_manage = trans.user == repository.user
+ can_manage = is_admin or trans.user == repository.user
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_rate = trans.user and repository.user != trans.user
can_upload = can_push
--- a/templates/webapps/community/repository/view_changeset.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/view_changeset.mako Fri Jul 08 16:11:28 2011 -0400
@@ -5,10 +5,11 @@
<%
from galaxy.web.framework.helpers import time_ago
+ is_admin = trans.user_is_admin()
is_new = repository.is_new
can_browse_contents = not is_new
can_rate = trans.user and repository.user != trans.user
- can_manage = trans.user == repository.user
+ can_manage = is_admin or trans.user == repository.user
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_view_change_log = not is_new
can_upload = can_push
--- a/templates/webapps/community/repository/view_repository.mako Fri Jul 08 09:09:02 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Fri Jul 08 16:11:28 2011 -0400
@@ -120,9 +120,9 @@
<div class="form-row"><label>Version:</label>
%if can_view_change_log:
- <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${tip}</a>
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${repository.version}</a>
%else:
- ${tip}
+ ${repository.version}
%endif
</div><div class="form-row">
@@ -145,6 +145,30 @@
%endif
</div></div>
+%if metadata:
+ <p/>
+ <div class="toolForm">
+ <div class="toolFormTitle">Repository metadata</div>
+ <div class="toolFormBody">
+ %if 'tools' in metadata:
+ <div class="form-row">
+ <label>Tools:</label>
+ <% tool_dicts = metadata[ 'tools' ] %>
+ <table class="grid">
+ %for tool_dict in tool_dicts:
+ <tr>
+ <td><a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ] )}">${tool_dict[ 'name' ]}</a></td>
+ <td>${tool_dict[ 'description' ]}</td>
+ <td>version: ${tool_dict[ 'version' ]}</td>
+ </tr>
+ %endfor
+ </table>
+ </div>
+ <div style="clear: both"></div>
+ %endif
+ </div>
+ </div>
+%endif
%if trans.user and trans.app.config.smtp_server:
<p/><div class="toolForm">
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.
10 years, 11 months
commit/galaxy-central: greg: Fix a bug when setting default history permissions in the user preferences; receiving method now gets all required params.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a787213d08e1/
changeset: a787213d08e1
user: greg
date: 2011-07-08 15:09:02
summary: Fix a bug when setting default history permissions in the user preferences; receiving method now gets all required params.
affected #: 2 files (470 bytes)
--- a/lib/galaxy/web/controllers/user.py Thu Jul 07 12:13:49 2011 -0400
+++ b/lib/galaxy/web/controllers/user.py Fri Jul 08 09:09:02 2011 -0400
@@ -914,6 +914,9 @@
@web.expose
def set_default_permissions( self, trans, cntrller, **kwd ):
"""Sets the user's default permissions for the new histories"""
+ params = util.Params( kwd )
+ message = util.restore_text( params.get( 'message', '' ) )
+ status = params.get( 'status', 'done' )
if trans.user:
if 'update_roles_button' in kwd:
p = util.Params( kwd )
@@ -926,8 +929,11 @@
action = trans.app.security_agent.get_action( v.action ).action
permissions[ action ] = in_roles
trans.app.security_agent.user_set_default_permissions( trans.user, permissions )
- return trans.show_ok_message( 'Default new history permissions have been changed.' )
- return trans.fill_template( 'user/permissions.mako', cntrller=cntrller )
+ message = 'Default new history permissions have been changed.'
+ return trans.fill_template( 'user/permissions.mako',
+ cntrller=cntrller,
+ message=message,
+ status=status )
else:
# User not logged in, history group must be only public
return trans.show_error_message( "You must be logged in to change your default permitted actions." )
--- a/templates/user/permissions.mako Thu Jul 07 12:13:49 2011 -0400
+++ b/templates/user/permissions.mako Fri Jul 08 09:09:02 2011 -0400
@@ -1,6 +1,13 @@
<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+<%namespace file="/dataset/security_common.mako" import="render_permission_form" />
+
<%def name="title()">Change Default Permissions on New Histories</%def>
-<%namespace file="/dataset/security_common.mako" import="render_permission_form" />
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
<br/><br/><ul class="manage-table-actions"><li>
@@ -8,5 +15,5 @@
</li></ul>
%if trans.user:
- ${render_permission_form( trans.user, trans.user.email, h.url_for(), trans.user.all_roles() )}
+ ${render_permission_form( trans.user, trans.user.email, h.url_for( controller='user', action='set_default_permissions', cntrller=cntrller ), trans.user.all_roles() )}
%endif
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.
10 years, 11 months
commit/galaxy-central: dan: Update annotation profiler tool sample configuration file.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/4220f8a5c571/
changeset: 4220f8a5c571
user: dan
date: 2011-07-07 18:13:49
summary: Update annotation profiler tool sample configuration file.
affected #: 2 files (153 bytes)
--- a/tool-data/annotation_profiler_options.xml.sample Thu Jul 07 11:55:14 2011 -0400
+++ b/tool-data/annotation_profiler_options.xml.sample Thu Jul 07 12:13:49 2011 -0400
@@ -1,4 +1,4 @@
-<filter type="meta_key" name="dbkey" value="hg18">
+<filter type="data_meta" data_ref="input1" meta_key="dbkey" value="hg18"><options><option name="Mapping and Sequencing Tracks" value="group-map"><option name="STS Markers" value="stsMap"/>
--- a/tools/annotation_profiler/annotation_profiler_for_interval.py Thu Jul 07 11:55:14 2011 -0400
+++ b/tools/annotation_profiler/annotation_profiler_for_interval.py Thu Jul 07 12:13:49 2011 -0400
@@ -340,6 +340,8 @@
options, args = parser.parse_args()
+ assert os.path.isdir( options.path ), IOError( "Configuration error: Table directory is missing (%s)" % options.path )
+
#get profiler_info
profiler_info = parse_profiler_info( os.path.join( options.path, 'profiler_info.txt' ) )
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.
10 years, 12 months
commit/galaxy-central: jgoecks: Trackster: implement broad/wide incremental data fetching and add icons for data fetching.
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/35c11787e690/
changeset: 35c11787e690
user: jgoecks
date: 2011-07-07 17:55:14
summary: Trackster: implement broad/wide incremental data fetching and add icons for data fetching.
affected #: 5 files (1.5 KB)
--- a/static/june_2007_style/blue/trackster.css Wed Jul 06 22:37:51 2011 -0400
+++ b/static/june_2007_style/blue/trackster.css Thu Jul 07 11:55:14 2011 -0400
@@ -51,3 +51,6 @@
.bookmark{background:white;border:solid #999 1px;border-right:none;margin:0.5em;margin-right:0;padding:0.5em;}
.bookmark .position{font-weight:bold;}
.delete-icon-container{float:right;}
+.icon{display:inline-block;width:16px;height:16px;}
+.icon.more-down{background:url('../images/fugue/arrow-transition-270-bw.png') no-repeat 0px 0px;}
+.icon.more-across{background:url('../images/fugue/arrow-transition-bw.png') no-repeat 0px 0px;}
--- a/static/june_2007_style/trackster.css.tmpl Wed Jul 06 22:37:51 2011 -0400
+++ b/static/june_2007_style/trackster.css.tmpl Thu Jul 07 11:55:14 2011 -0400
@@ -293,3 +293,16 @@
float:right;
}
+.icon {
+ display:inline-block;
+ width:16px;
+ height:16px;
+}
+.icon.more-down {
+ background:url('../images/fugue/arrow-transition-270-bw.png') no-repeat 0px 0px;
+}
+.icon.more-across{
+ background:url('../images/fugue/arrow-transition-bw.png') no-repeat 0px 0px;
+}
+
+
--- a/static/scripts/trackster.js Wed Jul 06 22:37:51 2011 -0400
+++ b/static/scripts/trackster.js Thu Jul 07 11:55:14 2011 -0400
@@ -172,7 +172,7 @@
// height of individual features within tracks. Feature height, then, should always be less
// than track height.
CHAR_HEIGHT_PX = 9, // FIXME: font size may not be static
- ERROR_PADDING = 18, // Padding at the top of tracks for error messages
+ ERROR_PADDING = 20, // Padding at the top of tracks for error messages
SUMMARY_TREE_TOP_PADDING = CHAR_HEIGHT_PX + 2,
// Maximum number of rows un a slotted track
MAX_FEATURE_DEPTH = 100,
@@ -369,13 +369,15 @@
//
// Set parameters based on request type.
//
+ var query_low = low;
if (req_type === this.DEEP_DATA_REQ) {
// Use same interval but set start_val to skip data that's already in cur_data.
$.extend(extra_params, {start_val: cur_data.data.length + 1});
}
else if (req_type === this.BROAD_DATA_REQ) {
- // Set low to be past the last feature returned.
- low = cur_data.data[cur_data.length-1][2] + 1;
+ // Set query low to be past the last feature returned so that an area of extreme feature depth
+ // is bypassed.
+ query_low = cur_data.data[cur_data.data.length - 1][2] + 1;
}
//
@@ -384,14 +386,19 @@
//
var
data_manager = this,
- new_data_request = this.load_data(low, high, resolution, extra_params)
+ new_data_request = this.load_data(query_low, high, resolution, extra_params)
new_data_available = $.Deferred();
// load_data sets cache to new_data_request, but use custom deferred object so that signal and data
// is all data, not just new data.
this.set_data(low, high, mode, new_data_available);
$.when(new_data_request).then(function(result) {
+ // Update data and message.
if (result.data) {
result.data = cur_data.data.concat(result.data);
+ if (result.message) {
+ // HACK: replace number in message with current data length. Works but is ugly.
+ result.message = result.message.replace(/[0-9]+/, result.data.length);
+ }
}
data_manager.set_data(low, high, mode, result);
new_data_available.resolve(result);
@@ -2209,18 +2216,29 @@
message_div = $("<div/>").addClass("tile-message").text(tile.message).
// -1 to account for border.
css({'height': ERROR_PADDING-1, 'width': tile.canvas.width}).appendTo(container_div),
- show_more_data_btn = $("<div/>").text("Show more").addClass("action-button").css({'padding-top': 0, 'padding-bottom':0}).appendTo(message_div);
+ more_down_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-down").appendTo(message_div),
+ more_across_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-across").appendTo(message_div);
container_div.append(canvas);
tile_element = container_div;
- // Set up actions for button.
- show_more_data_btn.click(function() {
+ // Set up actions for icons.
+ more_down_icon.click(function() {
// Mark tile as stale, request more data, and redraw track.
tile.stale = true;
track.data_manager.get_more_data(tile.low, tile.high, tile.resolution, {}, track.data_manager.DEEP_DATA_REQ);
track.draw();
}).dblclick(function(e) {
- // Do not propogate as this would normal zoom in.
+ // Do not propogate as this would normally zoom in.
+ e.stopPropagation();
+ });
+
+ more_across_icon.click(function() {
+ // Mark tile as stale, request more data, and redraw track.
+ tile.stale = true;
+ track.data_manager.get_more_data(tile.low, tile.high, tile.resolution, {}, track.data_manager.BROAD_DATA_REQ);
+ track.draw();
+ }).dblclick(function(e) {
+ // Do not propogate as this would normally zoom in.
e.stopPropagation();
});
}
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.
10 years, 12 months
commit/galaxy-central: kanwei: Add tool version-string support to tool wrappers. Use the <version_string> tag to denote the command to run for the tool version, such as: tophat --version (see tophat wrapper change for example)
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/84b20f29dfdf/
changeset: 84b20f29dfdf
user: kanwei
date: 2011-07-07 04:37:51
summary: Add tool version-string support to tool wrappers. Use the <version_string> tag to denote the command to run for the tool version, such as: tophat --version (see tophat wrapper change for example)
The tool version string will currently be appended to the Info string in the history dataset and you will be able to see it in the history pane, although this might be added to the database as well in the future.
affected #: 4 files (1.1 KB)
--- a/lib/galaxy/jobs/__init__.py Thu Jul 07 10:04:20 2011 +1000
+++ b/lib/galaxy/jobs/__init__.py Wed Jul 06 22:37:51 2011 -0400
@@ -271,7 +271,7 @@
class JobWrapper( object ):
"""
- Wraps a 'model.Job' with convience methods for running processes and
+ Wraps a 'model.Job' with convenience methods for running processes and
state management.
"""
def __init__( self, job, queue ):
@@ -284,6 +284,9 @@
self.sa_session = self.app.model.context
self.extra_filenames = []
self.command_line = None
+ # Tool versioning variables
+ self.version_string_cmd = None
+ self.version_string = ""
self.galaxy_lib_dir = None
# With job outputs in the working directory, we need the working
# directory to be set before prepare is run, or else premature deletion
@@ -311,6 +314,9 @@
param_dict = self.tool.params_from_strings( param_dict, self.app )
return param_dict
+ def get_version_string_path( self ):
+ return os.path.abspath(os.path.join(self.app.config.new_file_path, "GALAXY_VERSION_STRING_%s" % self.job_id))
+
def prepare( self ):
"""
Prepare the job to run by creating the working directory and the
@@ -389,6 +395,7 @@
extra_filenames.append( param_filename )
self.param_dict = param_dict
self.extra_filenames = extra_filenames
+ self.version_string_cmd = self.tool.version_string_cmd
return extra_filenames
def fail( self, message, exception=False ):
@@ -491,6 +498,12 @@
job.state = job.states.ERROR
else:
job.state = job.states.OK
+ if self.version_string_cmd:
+ version_filename = self.get_version_string_path()
+ if os.path.exists(version_filename):
+ self.version_string = "Tool version: %s" % open(version_filename).read()
+ os.unlink(version_filename)
+
if self.app.config.outputs_to_working_directory:
for dataset_path in self.get_output_fnames():
try:
@@ -541,7 +554,7 @@
dataset.blurb = 'done'
dataset.peek = 'no peek'
- dataset.info = context['stdout'] + context['stderr']
+ dataset.info = context['stdout'] + context['stderr'] + self.version_string
dataset.set_size()
if context['stderr']:
dataset.blurb = "error"
--- a/lib/galaxy/jobs/runners/__init__.py Thu Jul 07 10:04:20 2011 +1000
+++ b/lib/galaxy/jobs/runners/__init__.py Wed Jul 06 22:37:51 2011 -0400
@@ -1,10 +1,9 @@
import os, os.path
class BaseJobRunner( object ):
-
def build_command_line( self, job_wrapper, include_metadata=False ):
"""
- Compose the sequence of commands neccesary to execute a job. This will
+ Compose the sequence of commands necessary to execute a job. This will
currently include:
- environment settings corresponding to any requirement tags
- command line taken from job wrapper
@@ -15,9 +14,13 @@
# occur
if not commands:
return None
+ # Prepend version string
+ if job_wrapper.version_string_cmd:
+ commands = "%s &> %s; " % ( job_wrapper.version_string_cmd, job_wrapper.get_version_string_path() ) + commands
# Prepend dependency injection
if job_wrapper.dependency_shell_commands:
commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] )
+
# Append metadata setting commands, we don't want to overwrite metadata
# that was copied over in init_meta(), as per established behavior
if include_metadata and self.app.config.set_metadata_externally:
--- a/lib/galaxy/tools/__init__.py Thu Jul 07 10:04:20 2011 +1000
+++ b/lib/galaxy/tools/__init__.py Wed Jul 06 22:37:51 2011 -0400
@@ -5,7 +5,7 @@
pkg_resources.require( "simplejson" )
-import logging, os, string, sys, tempfile, glob, shutil, types, urllib
+import logging, os, string, sys, tempfile, glob, shutil, types, urllib, subprocess
import simplejson
import binascii
from UserDict import DictMixin
@@ -395,6 +395,10 @@
self.redirect_url_params = ''
# Short description of the tool
self.description = util.xml_text(root, "description")
+ # Versioning for tools
+ self.version_string_cmd = None
+ if root.find("version_string") is not None:
+ self.version_string_cmd = root.find("version_string").text
# Parallelism for tasks, read from tool config.
parallelism = root.find("parallelism")
if parallelism is not None and parallelism.get("method"):
--- a/tools/ngs_rna/tophat_wrapper.xml Thu Jul 07 10:04:20 2011 +1000
+++ b/tools/ngs_rna/tophat_wrapper.xml Wed Jul 06 22:37:51 2011 -0400
@@ -1,5 +1,6 @@
<tool id="tophat" name="Tophat for Illumina" version="1.5.0"><description>Find splice junctions using RNA-seq data</description>
+ <version_string>tophat --version</version_string><requirements><requirement type="package">tophat</requirement></requirements>
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.
10 years, 12 months
commit/galaxy-central: fubar: More comprehensive error detection for weblogo installation or execution errors
by Bitbucket
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/d271dfcdf482/
changeset: d271dfcdf482
user: fubar
date: 2011-07-07 02:04:20
summary: More comprehensive error detection for weblogo installation or execution errors
affected #: 2 files (431 bytes)
--- a/tools/rgenetics/rgWebLogo3.py Wed Jul 06 10:20:57 2011 -0400
+++ b/tools/rgenetics/rgWebLogo3.py Thu Jul 07 10:04:20 2011 +1000
@@ -43,6 +43,11 @@
tlf = open(templog,'w')
process = subprocess.Popen(cl, shell=True, stderr=tlf, stdout=tlf)
rval = process.wait()
+ if rval <> 0:
+ print >> sys.stderr, '## rgWebLogo3.py error - executing %s returned error code %d' % cl
+ print >> sys.stderr, '## This may be a data problem or a tool dependency (%s) installation problem' % WEBLOGO
+ print >> sys.stderr, '## Please ensure %s is correctly installed and working on the command line -see http://code.google.com/p/weblogo' % WEBLOGO
+ sys.exit(1)
tlf.close()
tlogs = ''.join(open(templog,'r').readlines())
if len(tlogs) > 1:
--- a/tools/rgenetics/rgWebLogo3.xml Wed Jul 06 10:20:57 2011 -0400
+++ b/tools/rgenetics/rgWebLogo3.xml Thu Jul 07 10:04:20 2011 +1000
@@ -1,4 +1,4 @@
-<tool id="rgweblogo3" name="Sequence Logo" version="0.3">
+<tool id="rgweblogo3" name="Sequence Logo" version="0.4"><description>generator for fasta (eg Clustal alignments)</description><command interpreter="python">
rgWebLogo3.py -F $outformat -s $size -i $input -o $output -t "$logoname" -c "$colours" -U "$units"
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.
10 years, 12 months