1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/95815478f355/ Changeset: 95815478f355 User: greg Date: 2013-10-18 22:43:29 Summary: Enhance the Repair repository feature for tool shed repositories installed into Galaxy to handle repository and tool dependencies that are not only in an error status, but may also have one of the "installing" status values. This feature will now properly handle dependencies that are stuck in one of these installing states foe some reason. Existing system processes are not automatically killed (if they happen to exist), but warning messages are displayed. Affected #: 7 files diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3679,7 +3679,11 @@ """Return the repository's repository dependencies that are currently being installed.""" required_repositories_being_installed = [] for required_repository in self.repository_dependencies: - if required_repository.status == self.installation_status.INSTALLING: + if required_repository.status in [ self.installation_status.CLONING, + self.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES, + self.installation_status.INSTALLING_TOOL_DEPENDENCIES, + self.installation_status.LOADING_PROPRIETARY_DATATYPES, + self.installation_status.SETTING_TOOL_VERSIONS ]: required_repositories_being_installed.append( required_repository ) return required_repositories_being_installed diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -1185,6 +1185,21 @@ message=message, status=status ) + @web.expose + @web.require_admin + def repair_tool_shed_repositories( self, trans, tool_shed_repositories, repo_info_dicts, **kwd ): + """Repair specified tool shed repositories.""" + # The received lists of tool_shed_repositories and repo_info_dicts are ordered. + for index, tool_shed_repository in enumerate( tool_shed_repositories ): + repo_info_dict = repo_info_dicts[ index ] + repair_dict = repository_util.repair_tool_shed_repository( trans, + tool_shed_repository, + encoding_util.tool_shed_encode( repo_info_dict ) ) + tsr_ids_for_monitoring = [ trans.security.encode_id( tsr.id ) for tsr in tool_shed_repositories ] + return trans.response.send_redirect( web.url_for( controller='admin_toolshed', + action='monitor_repository_installation', + tool_shed_repository_ids=tsr_ids_for_monitoring ) ) + @web.json def repository_installation_status_updates( self, trans, ids=None, status_list=None ): # Avoid caching @@ -1208,21 +1223,6 @@ @web.expose @web.require_admin - def repair_tool_shed_repositories( self, trans, tool_shed_repositories, repo_info_dicts, **kwd ): - """Repair specified tool shed repositories.""" - # The received lists of tool_shed_repositories and repo_info_dicts are ordered. - for index, tool_shed_repository in enumerate( tool_shed_repositories ): - repo_info_dict = repo_info_dicts[ index ] - repair_dict = repository_util.repair_tool_shed_repository( trans, - tool_shed_repository, - encoding_util.tool_shed_encode( repo_info_dict ) ) - tsr_ids_for_monitoring = [ trans.security.encode_id( tsr.id ) for tsr in tool_shed_repositories ] - return trans.response.send_redirect( web.url_for( controller='admin_toolshed', - action='monitor_repository_installation', - tool_shed_repository_ids=tsr_ids_for_monitoring ) ) - - @web.expose - @web.require_admin def reselect_tool_panel_section( self, trans, **kwd ): """ Select or change the tool panel section to contain the tools included in the tool shed repository being reinstalled. If there are updates diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py --- a/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py +++ b/lib/tool_shed/galaxy_install/grids/admin_toolshed_grids.py @@ -101,33 +101,7 @@ class StatusColumn( grids.TextColumn ): def get_value( self, trans, grid, tool_shed_repository ): - status_label = tool_shed_repository.status - if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.CLONING, - trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS, - trans.model.ToolShedRepository.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES, - trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES, - trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]: - bgcolor = trans.model.ToolShedRepository.states.INSTALLING - elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.NEW, - trans.model.ToolShedRepository.installation_status.UNINSTALLED ]: - bgcolor = trans.model.ToolShedRepository.states.UNINSTALLED - elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.ERROR ]: - bgcolor = trans.model.ToolShedRepository.states.ERROR - elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]: - bgcolor = trans.model.ToolShedRepository.states.WARNING - elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]: - if tool_shed_repository.missing_repository_dependencies: - bgcolor = trans.model.ToolShedRepository.states.WARNING - status_label = '%s, missing repository dependencies' % status_label - elif tool_shed_repository.missing_tool_dependencies: - bgcolor = trans.model.ToolShedRepository.states.WARNING - status_label = '%s, missing tool dependencies' % status_label - else: - bgcolor = trans.model.ToolShedRepository.states.OK - else: - bgcolor = trans.model.ToolShedRepository.states.ERROR - rval = '<div class="count-box state-color-%s">%s</div>' % ( bgcolor, status_label ) - return rval + return suc.get_tool_shed_repository_status_label( trans, tool_shed_repository ) class ToolShedColumn( grids.TextColumn ): diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded lib/tool_shed/galaxy_install/repository_util.py --- a/lib/tool_shed/galaxy_install/repository_util.py +++ b/lib/tool_shed/galaxy_install/repository_util.py @@ -758,7 +758,6 @@ log.debug( error_message ) repair_dict [ repository.name ] = error_message elif repository.status not in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]: - # TODO: this may cause problems if the repository is currently being installed. shed_tool_conf, tool_path, relative_install_dir = suc.get_tool_panel_config_tool_path_install_dir( trans.app, repository ) # Reset the repository attributes to the New state for installation. if metadata: @@ -793,7 +792,8 @@ work_dir = tempfile.mkdtemp( prefix="tmp-toolshed-itdep" ) # Reset missing tool dependencies. for tool_dependency in repository.missing_tool_dependencies: - if tool_dependency.status in [ trans.model.ToolDependency.installation_status.ERROR ]: + if tool_dependency.status in [ trans.model.ToolDependency.installation_status.ERROR, + trans.model.ToolDependency.installation_status.INSTALLING ]: tool_dependency_util.set_tool_dependency_attributes( trans, tool_dependency, trans.model.ToolDependency.installation_status.UNINSTALLED, diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -1282,6 +1282,53 @@ log.exception( "Error attempting to get tool shed status for installed repository %s: %s" % ( str( repository.name ), str( e ) ) ) return {} +def get_tool_shed_repository_status_label( trans, tool_shed_repository=None, name=None, owner=None, changeset_revision=None, repository_clone_url=None ): + """Return a color-coded label for the status of the received tool-shed_repository installed into Galaxy.""" + if tool_shed_repository is None: + if name is not None and owner is not None and repository_clone_url is not None: + tool_shed = get_tool_shed_from_clone_url( repository_clone_url ) + tool_shed_repository = get_tool_shed_repository_by_shed_name_owner_installed_changeset_revision( trans.app, + tool_shed, + name, + owner, + changeset_revision ) + if tool_shed_repository: + status_label = tool_shed_repository.status + if tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.CLONING, + trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS, + trans.model.ToolShedRepository.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES, + trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES, + trans.model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]: + bgcolor = trans.model.ToolShedRepository.states.INSTALLING + elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.NEW, + trans.model.ToolShedRepository.installation_status.UNINSTALLED ]: + bgcolor = trans.model.ToolShedRepository.states.UNINSTALLED + elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.ERROR ]: + bgcolor = trans.model.ToolShedRepository.states.ERROR + elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]: + bgcolor = trans.model.ToolShedRepository.states.WARNING + elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]: + if tool_shed_repository.repository_dependencies_being_installed: + bgcolor = trans.model.ToolShedRepository.states.WARNING + status_label = '%s, %s' % ( status_label, trans.model.ToolShedRepository.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES ) + elif tool_shed_repository.missing_repository_dependencies: + bgcolor = trans.model.ToolShedRepository.states.WARNING + status_label = '%s, missing repository dependencies' % status_label + elif tool_shed_repository.tool_dependencies_being_installed: + bgcolor = trans.model.ToolShedRepository.states.WARNING + status_label = '%s, %s' % (status_label, trans.model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES ) + elif tool_shed_repository.missing_tool_dependencies: + bgcolor = trans.model.ToolShedRepository.states.WARNING + status_label = '%s, missing tool dependencies' % status_label + else: + bgcolor = trans.model.ToolShedRepository.states.OK + else: + bgcolor = trans.model.ToolShedRepository.states.ERROR + else: + bgcolor = trans.model.ToolShedRepository.states.WARNING + status_label = '%s, unknown status' % status_label + return '<div class="count-box state-color-%s">%s</div>' % ( bgcolor, status_label ) + def get_updated_changeset_revisions( trans, name, owner, changeset_revision ): """ Return a string of comma-separated changeset revision hashes for all available updates to the received changeset revision for the repository diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded templates/admin/tool_shed_repository/repair_repository.mako --- a/templates/admin/tool_shed_repository/repair_repository.mako +++ b/templates/admin/tool_shed_repository/repair_repository.mako @@ -18,27 +18,56 @@ %endif <div class="warningmessage"> - The following repositories will be inspected and repaired in the order listed to ensure each repository and all of it's tool dependencies are correctly - installed. Click <b>Repair</b> to inspect and repair these repositories. + <p> + The following repositories will be inspected and repaired in the order listed to ensure each repository and all of it's tool dependencies are + correctly installed. + </p> + <p> + Existing system processes associated with repositories or tool dependencies that are currently being installed will not be automatically + terminated. If possible, make sure no installation processes are still running for repositories whose status is or includes <b>cloning</b>, + <b>setting tool versions</b>, <b>installing repository dependencies</b>, or <b>installing tool dependencies</b> before clicking the <b>Repair</b> + button. + </p> + <p> + All repositories that do not display an <b>Installed</b> status will be removed from disk and reinstalled. + </p> + <p> + Click <b>Repair</b> to inspect and repair these repositories. + </p></div><div class="toolForm"> - <div class="toolFormTitle">Repair tool shed repository '${repository.name}'</div> - <br/><br/> - <form name="repair_repository" id="repair_repository" action="${h.url_for( controller='admin_toolshed', action='repair_repository', id=trans.security.encode_id( repository.id ), repair_dict=encoded_repair_dict )}" method="post" > - <% ordered_repo_info_dicts = repair_dict.get( 'ordered_repo_info_dicts', [] ) %> + <div class="toolFormTitle">Repair tool shed repository <b>${repository.name}</b></div> + <form name="repair_repository" id="repair_repository" action="${h.url_for( controller='admin_toolshed', action='repair_repository', id=trans.security.encode_id( repository.id ) )}" method="post" > + <input type="hidden" name="repair_dict" value="${encoded_repair_dict}"/> + <% + from tool_shed.util.shed_util_common import get_tool_shed_repository_status_label + ordered_repo_info_dicts = repair_dict.get( 'ordered_repo_info_dicts', [] ) + %><table class="grid"> - <tr><th bgcolor="#D8D8D8">Name</th><th bgcolor="#D8D8D8">Owner</th><th bgcolor="#D8D8D8">Changeset revision</th></tr> + <tr> + <th bgcolor="#D8D8D8">Name</th> + <th bgcolor="#D8D8D8">Owner</th> + <th bgcolor="#D8D8D8">Changeset revision</th> + <th bgcolor="#D8D8D8">Status</th> + </tr> %for repo_info_dict in ordered_repo_info_dicts: <% for name, repo_info_tuple in repo_info_dict.items(): description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, tool_dependencies = repo_info_tuple break + status_label = get_tool_shed_repository_status_label( trans, + tool_shed_repository=None, + name=name, + owner=repository_owner, + changeset_revision=changeset_revision, + repository_clone_url=repository_clone_url ) %><tr><td>${name | h}</td><td>${repository_owner | h}</td><td>${changeset_revision | h}</td> + <td>${status_label}</td></tr> %endfor </table> diff -r 068afb09a7ba896f1fdfee104d0b68c0a2e77de3 -r 95815478f355009d925ea91e95e4db0a9d887ded test/tool_shed/base/twilltestcase.py --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -969,7 +969,7 @@ self.check_for_strings( [ 'Metadata has been reset' ] ) def reset_metadata_on_selected_repositories( self, repository_ids ): - self.visit_url( '/admin/reset_metadata_on_selected_repositories' ) + self.visit_url( '/admin/reset_metadata_on_selected_repositories_in_tool_shed' ) kwd = dict( repository_ids=repository_ids ) self.submit_form( form_no=1, button="reset_metadata_on_selected_repositories_button", **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.