commit/galaxy-central: greg: Handle installation of a tool_dependency independent of its containing repository (due to it being in an error state) in the installed_repository_manager.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/c5915b15b421/ Changeset: c5915b15b421 User: greg Date: 2013-12-12 01:05:18 Summary: Handle installation of a tool_dependency independent of its containing repository (due to it being in an error state) in the installed_repository_manager. Affected #: 5 files diff -r 4501db4f8ac29c0c351a861611217d23159272c5 -r c5915b15b4211aa1fe75c6d9238ea1ae094a71ce 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 @@ -267,7 +267,7 @@ tool_shed_repository.error_message = None # Remove the uninstalled repository and any tool dependencies from the in-memory dictionaries in the # installed_repository_manager. - trans.app.installed_repository_manager.handle_uninstall( tool_shed_repository ) + trans.app.installed_repository_manager.handle_repository_uninstall( tool_shed_repository ) else: tool_shed_repository.status = trans.install_model.ToolShedRepository.installation_status.DEACTIVATED trans.install_model.context.add( tool_shed_repository ) diff -r 4501db4f8ac29c0c351a861611217d23159272c5 -r c5915b15b4211aa1fe75c6d9238ea1ae094a71ce lib/tool_shed/galaxy_install/installed_repository_manager.py --- a/lib/tool_shed/galaxy_install/installed_repository_manager.py +++ b/lib/tool_shed/galaxy_install/installed_repository_manager.py @@ -160,7 +160,7 @@ return relative_path return None - def handle_install( self, repository ): + def handle_repository_install( self, repository ): """Load the dependency relationships for a repository that was just installed or reinstalled.""" # Populate self.repository_dependencies_of_installed_repositories. self.add_entry_to_repository_dependencies_of_installed_repositories( repository ) @@ -176,10 +176,10 @@ # Populate self.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies. self.add_entry_to_installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies( tool_dependency ) - def handle_uninstall( self, repository ): + def handle_repository_uninstall( self, repository ): """Remove the dependency relationships for a repository that was just uninstalled.""" for tool_dependency in repository.tool_dependencies: - # Remove all this tool_dependency from all values in + # Remove this tool_dependency from all values in # self.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies altered_installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies = {} for td, installed_runtime_dependent_tool_dependencies in \ @@ -208,6 +208,19 @@ # Remove this repository's entry from self.repository_dependencies_of_installed_repositories. self.remove_entry_from_repository_dependencies_of_installed_repositories( repository ) + def handle_tool_dependency_install( self, repository, tool_dependency ): + """Load the dependency relationships for a tool dependency that was just installed independently of its containing repository.""" + # The received repository must have a status of 'Installed'. The value of tool_dependency.status will either be + # 'Installed' or 'Error', but we only need to change the in-memory dictionaries if it is 'Installed'. + if tool_dependency.is_installed: + # Populate self.installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies. + self.add_entry_to_installed_runtime_dependent_tool_dependencies_of_installed_tool_dependencies( tool_dependency ) + # Populate self.installed_tool_dependencies_of_installed_repositories. + for r in self.installed_tool_dependencies_of_installed_repositories: + if r.id == repository.id: + self.installed_tool_dependencies_of_installed_repositories[ r ].append( tool_dependency ) + break + @property def ids_of_installed_repository_dependencies_of_installed_repositories_keys( self ): return [ r.id for r in self.installed_repository_dependencies_of_installed_repositories.keys() ] diff -r 4501db4f8ac29c0c351a861611217d23159272c5 -r c5915b15b4211aa1fe75c6d9238ea1ae094a71ce 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 @@ -583,7 +583,7 @@ tool_shed_repository, trans.install_model.ToolShedRepository.installation_status.INSTALLED ) # Add the installed repository and any tool dependencies to the in-memory dictionaries in the installed_repository_manager. - trans.app.installed_repository_manager.handle_install( tool_shed_repository ) + trans.app.installed_repository_manager.handle_repository_install( tool_shed_repository ) else: # An error occurred while cloning the repository, so reset everything necessary to enable another attempt. set_repository_attributes( trans, diff -r 4501db4f8ac29c0c351a861611217d23159272c5 -r c5915b15b4211aa1fe75c6d9238ea1ae094a71ce lib/tool_shed/util/common_install_util.py --- a/lib/tool_shed/util/common_install_util.py +++ b/lib/tool_shed/util/common_install_util.py @@ -489,6 +489,8 @@ if tool_dependency and tool_dependency.status in [ app.install_model.ToolDependency.installation_status.INSTALLED, app.install_model.ToolDependency.installation_status.ERROR ]: installed_tool_dependencies.append( tool_dependency ) + # Add the tool_dependency to the in-memory dictionaries in the installed_repository_manager. + app.installed_repository_manager.handle_tool_dependency_install( tool_shed_repository, tool_dependency ) elif elem.tag == 'set_environment': # <set_environment version="1.0"> # <environment_variable name="R_SCRIPT_PATH"action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable> diff -r 4501db4f8ac29c0c351a861611217d23159272c5 -r c5915b15b4211aa1fe75c6d9238ea1ae094a71ce lib/tool_shed/util/tool_dependency_util.py --- a/lib/tool_shed/util/tool_dependency_util.py +++ b/lib/tool_shed/util/tool_dependency_util.py @@ -512,6 +512,7 @@ return installed_tool_dependencies, missing_tool_dependencies def remove_tool_dependency( app, tool_dependency ): + """The received tool_dependency must be in an error state.""" context = app.install_model.context dependency_install_dir = tool_dependency.installation_directory( app ) removed, error_message = remove_tool_dependency_installation_directory( dependency_install_dir ) @@ -520,6 +521,9 @@ tool_dependency.error_message = None context.add( tool_dependency ) context.flush() + # Since the received tool_dependency is in an error state, nothing will need to be changed in any + # of the in-memory dictionaries in the installed_repository_manager because changing the state from + # error to uninstalled requires no in-memory changes.. return removed, error_message def remove_tool_dependency_installation_directory( dependency_install_dir ): 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)
-
commits-noreply@bitbucket.org