commit/galaxy-central: greg: Add the ability to review tools migration stages that are available for the current Galaxy instance.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/c56a600064a4/ changeset: c56a600064a4 user: greg date: 2012-09-21 17:21:38 summary: Add the ability to review tools migration stages that are available for the current Galaxy instance. affected #: 4 files diff -r cd739bd3dca4859fecfe499fc976b0e0b6478238 -r c56a600064a4add89de1c970e99983ae438b8db2 lib/galaxy/tool_shed/migrate/versions/0004_tools.py --- a/lib/galaxy/tool_shed/migrate/versions/0004_tools.py +++ b/lib/galaxy/tool_shed/migrate/versions/0004_tools.py @@ -1,9 +1,9 @@ """ The NCBI BLAST+ tools have been eliminated from the distribution. The tools and -datatypes are are now available in repositories named ncbi_blast_plus and -blast_datatypes, respectively, from the main Galaxy tool shed at -http://toolshed.g2.bx.psu.edu will be installed into your local Galaxy instance -at the location discussed above by running the following command. +datatypes are now available in repositories named ncbi_blast_plus and +blast_datatypes, in the main Galaxy tool shed at http://toolshed.g2.bx.psu.edu. +These repositories will be installed into your local Galaxy instance at the +location discussed above by running the following command. """ import sys diff -r cd739bd3dca4859fecfe499fc976b0e0b6478238 -r c56a600064a4add89de1c970e99983ae438b8db2 lib/galaxy/web/controllers/admin.py --- a/lib/galaxy/web/controllers/admin.py +++ b/lib/galaxy/web/controllers/admin.py @@ -8,8 +8,10 @@ from galaxy.actions.admin import AdminActions from galaxy.web.params import QuotaParamParser from galaxy.exceptions import * +from galaxy.util.odict import * +from galaxy.tool_shed.encoding_util import * import galaxy.datatypes.registry -import logging +import logging, imp, subprocess, urllib2 log = logging.getLogger( __name__ ) @@ -685,6 +687,75 @@ if emails is None: emails = [ u.email for u in trans.sa_session.query( trans.app.model.User ).enable_eagerloads( False ).all() ] return trans.fill_template( 'admin/impersonate.mako', emails=emails, message=message, status=status ) + def get_tool_shed_url_from_tools_xml_file_path( self, trans, tool_shed ): + search_str = '://%s' % tool_shed + for shed_name, shed_url in trans.app.tool_shed_registry.tool_sheds.items(): + if shed_url.find( search_str ) >= 0: + if shed_url.endswith( '/' ): + shed_url = shed_url.rstrip( '/' ) + return shed_url + return None + def check_for_tool_dependencies( self, trans, migration_stage ): + # Get the 000x_tools.xml file associated with migration_stage. + tools_xml_file_path = os.path.abspath( os.path.join( trans.app.config.root, 'scripts', 'migrate_tools', '%04d_tools.xml' % migration_stage ) ) + tree = util.parse_xml( tools_xml_file_path ) + root = tree.getroot() + tool_shed = root.get( 'name' ) + tool_shed_url = self.get_tool_shed_url_from_tools_xml_file_path( trans, tool_shed ) + repo_name_dependency_tups = [] + if tool_shed_url: + for elem in root: + if elem.tag == 'repository': + tool_dependencies = [] + tool_dependencies_dict = {} + repository_name = elem.get( 'name' ) + changeset_revision = elem.get( 'changeset_revision' ) + url = '%s/repository/get_tool_dependencies?name=%s&owner=devteam&changeset_revision=%s&webapp=install_manager' % \ + ( tool_shed_url, repository_name, changeset_revision ) + response = urllib2.urlopen( url ) + text = response.read() + response.close() + if text: + tool_dependencies_dict = tool_shed_decode( text ) + for dependency_key, requirements_dict in tool_dependencies_dict.items(): + tool_dependency_name = requirements_dict[ 'name' ] + tool_dependency_version = requirements_dict[ 'version' ] + tool_dependency_type = requirements_dict[ 'type' ] + tool_dependency_readme = requirements_dict.get( 'readme', '' ) + tool_dependencies.append( ( tool_dependency_name, tool_dependency_version, tool_dependency_type, tool_dependency_readme ) ) + repo_name_dependency_tups.append( ( repository_name, tool_dependencies ) ) + return repo_name_dependency_tups + @web.expose + @web.require_admin + def review_tool_migration_stages( self, trans, **kwd ): + message = util.restore_text( kwd.get( 'message', '' ) ) + status = util.restore_text( kwd.get( 'status', 'done' ) ) + migration_stages_dict = odict() + migration_modules = [] + migration_scripts_dir = os.path.abspath( os.path.join( trans.app.config.root, 'lib', 'galaxy', 'tool_shed', 'migrate', 'versions' ) ) + migration_scripts_dir_contents = os.listdir( migration_scripts_dir ) + for item in migration_scripts_dir_contents: + if os.path.isfile( os.path.join( migration_scripts_dir, item ) ) and item.endswith( '.py' ): + module = item.replace( '.py', '' ) + migration_modules.append( module ) + if migration_modules: + migration_modules.sort() + # Remove the 0001_tools.py script since it is the seed. + migration_modules = migration_modules[ 1: ] + # Reverse the list so viewing will be newest to oldest. + migration_modules.reverse() + for migration_module in migration_modules: + migration_stage = int( migration_module.replace( '_tools', '' ) ) + repo_name_dependency_tups = self.check_for_tool_dependencies( trans, migration_stage ) + open_file_obj, file_name, description = imp.find_module( migration_module, [ migration_scripts_dir ] ) + imported_module = imp.load_module( 'upgrade', open_file_obj, file_name, description ) + migration_info = imported_module.__doc__ + open_file_obj.close() + migration_stages_dict[ migration_stage ] = ( migration_info, repo_name_dependency_tups ) + return trans.fill_template( 'admin/review_tool_migration_stages.mako', + migration_stages_dict=migration_stages_dict, + message=message, + status=status ) @web.expose @web.require_admin def view_datatypes_registry( self, trans, **kwd ): diff -r cd739bd3dca4859fecfe499fc976b0e0b6478238 -r c56a600064a4add89de1c970e99983ae438b8db2 templates/admin/review_tool_migration_stages.mako --- /dev/null +++ b/templates/admin/review_tool_migration_stages.mako @@ -0,0 +1,120 @@ +<%inherit file="/base.mako"/> +<%namespace file="/message.mako" import="render_msg" /> + +%if message: + ${render_msg( message, status )} +%endif + +<div class="toolForm"> + <div class="toolFormTitle">Tool migrations that can be performed on this Galaxy instance</div> + <div class="toolFormBody"> + <div class="form-row"> + <p> + The list of tool migration stages below, displayed most recent to oldest, provides information about the repositories in the + main Galaxy tool shed that will be cloned at each stage if you run the shell command for that stage. This enables you to execute + the migration process for any stage at any time. + </p> + <p> + Keep in mind that tools included in a repository that you want to be displayed in the Galaxy tool panel when the repository is + installed must be defined in the <b>tool_conf.xml</b> (or equivalent) config file prior to execution of the migration process for a + stage. Executing a migration process multiple times will have no affect unless the repositories associated with that stage have been + uninstalled prior to the execution of the migration process. + </p> + <p> + When you initiate a migration process, the associated repositories will be cloned from the Galaxy tool shed at + <a href="http://toolshed.g2.bx.psu.edu" target="_blank">http://toolshed.g2.bx.psu.edu</a>. The location in which the tool repositories + will be installed is the value of the 'tool_path' attribute in the <tool> tag of the file named ./migrated_tool_conf.xml + (i.e., <b><toolbox tool_path="../shed_tools"></b>). The default location setting is <b>'../shed_tools'</b>, which may be problematic + for some cluster environments, so make sure to change it before you execute the installation process if appropriate. The configured location + must be outside of the Galaxy installation directory or it must be in a sub-directory protected by a properly configured <b>.hgignore</b> + file if the directory is within the Galaxy installation directory hierarchy. This is because tool shed repositories will be installed using + mercurial's clone feature, which creates .hg directories and associated mercurial repository files. Not having <b>.hgignore</b> properly + configured could result in undesired behavior when modifying or updating your local Galaxy instance or the tool shed repositories if they are + in directories that pose conflicts. See mercurial's .hgignore documentation at + <a href="http://mercurial.selenic.com/wiki/.hgignore" target="_blank">http://mercurial.selenic.com/wiki/.hgignore</a> for details. + </p> + </div> + <table class="grid"> + %for stage in migration_stages_dict.keys(): + <% + migration_command = 'sh ./scripts/migrate_tools/%04d_tools.sh' % stage + install_dependencies = '%s install_dependencies' % migration_command + migration_tup = migration_stages_dict[ stage ] + migration_info, repo_name_dependency_tups = migration_tup + repository_names = [] + for repo_name_dependency_tup in repo_name_dependency_tups: + repository_name, tool_dependencies = repo_name_dependency_tup + if repository_name not in repository_names: + repository_names.append( repository_name ) + if repository_names: + repository_names.sort() + repository_names = ', '.join( repository_names ) + %> + <tr><td bgcolor="#D8D8D8"><b>Tool migration stage ${stage} - repositories: ${repository_names}</b></td></tr> + <tr> + <td bgcolor="#FFFFCC"> + <div class="form-row"> + <p>${migration_info} <b>Run commands from the Galaxy installation directory!</b></p> + <p> + %if tool_dependencies: + This migration stage includes tools that have tool dependencies that can be automatically installed. To install them, run:<br/> + <b>${install_dependencies}</b><br/><br/> + To skip tool dependency installation run:<br/> + <b>${migration_command}</b> + %else: + <b>${migration_command}</b> + %endif + </p> + </div> + </td> + </tr> + %for repo_name_dependency_tup in repo_name_dependency_tups: + <% repository_name, tool_dependencies = repo_name_dependency_tup %> + <tr> + <td bgcolor="#DADFEF"> + <div class="form-row"> + <b>Repository:</b> ${repository_name} + </div> + </td> + </tr> + %if tool_dependencies: + <tr> + <td> + <div class="form-row"> + <b>Tool dependencies</b> + </div> + </td> + </tr> + %for tool_dependencies_tup in tool_dependencies: + <% + tool_dependency_name = tool_dependencies_tup[0] + tool_dependency_version = tool_dependencies_tup[1] + tool_dependency_type = tool_dependencies_tup[2] + installation_requirements = tool_dependencies_tup[3].replace( '\n', '<br/>' ) + %> + <tr> + <td> + <div class="form-row"> + <b>Name:</b> ${tool_dependency_name} <b>Version:</b> ${tool_dependency_version} <b>Type:</b> ${tool_dependency_type} + </div> + <div class="form-row"> + <b>Requirements and installation information:</b><br/> + ${installation_requirements} + </div> + </td> + </tr> + %endfor + %else: + <tr> + <td> + <div class="form-row"> + No tool dependencies have been defined for this repository. + </div> + </td> + </tr> + %endif + %endfor + %endfor + </table> + </div> +</div> diff -r cd739bd3dca4859fecfe499fc976b0e0b6478238 -r c56a600064a4add89de1c970e99983ae438b8db2 templates/webapps/galaxy/admin/index.mako --- a/templates/webapps/galaxy/admin/index.mako +++ b/templates/webapps/galaxy/admin/index.mako @@ -66,10 +66,11 @@ <div class="toolSectionBody"><div class="toolSectionBg"><div class="toolTitle"><a href="${h.url_for( controller='admin', action='view_datatypes_registry' )}" target="galaxy_main">View datatypes registry</a></div> - <div class="toolTitle"><a href="${h.url_for( controller='admin', action='tool_versions' )}" target="galaxy_main">Tool versions</a></div> + <div class="toolTitle"><a href="${h.url_for( controller='admin', action='tool_versions' )}" target="galaxy_main">View tool lineage</a></div><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 class="toolTitle"><a href="${h.url_for( controller='admin', action='review_tool_migration_stages' )}" target="galaxy_main">Review tool migration stages</a></div> %if installing_repository_ids: <div class="toolTitle"><a href="${h.url_for( controller='admin_toolshed', action='monitor_repository_installation', tool_shed_repository_ids=installing_repository_ids )}" target="galaxy_main">Monitor installing tool shed repositories</a></div> %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.
participants (1)
-
Bitbucket