Skip to content

Commit

Permalink
Drop tool_migration_manager and all references to it (see note)
Browse files Browse the repository at this point in the history
The from_tool_migration_manager parameter as False as its default value.
The only case where it's called with the value True is when it's called
from the from_tool_migration_manager module - which is now deleted.
Therefore, now the value is always False and, therefore, it is safe to
drop this parameter and adjust the code that checks its value accordingly.
  • Loading branch information
jdavcs committed Dec 20, 2021
1 parent e787ce1 commit 3fe5d60
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 733 deletions.
13 changes: 4 additions & 9 deletions lib/galaxy/tool_shed/galaxy_install/install_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ def install_and_build_package_via_fabric(self, install_environment, tool_shed_re
tool_dependency = self.mark_tool_dependency_installed(tool_dependency)
return tool_dependency

def install_specified_tool_dependencies(self, tool_shed_repository, tool_dependencies_config, tool_dependencies,
from_tool_migration_manager=False):
def install_specified_tool_dependencies(self, tool_shed_repository, tool_dependencies_config, tool_dependencies):
"""
Follow the recipe in the received tool_dependencies_config to install specified packages for
repository tools. The received list of tool_dependencies are the database records for those
Expand Down Expand Up @@ -191,14 +190,12 @@ def install_specified_tool_dependencies(self, tool_shed_repository, tool_depende
elem,
name,
version,
from_tool_migration_manager=from_tool_migration_manager,
tool_dependency_db_records=tool_dependencies)
if (tool_dependency.type == 'package' and proceed_with_install):
try:
tool_dependency = self.install_package(elem,
tool_shed_repository,
tool_dependencies=tool_dependencies,
from_tool_migration_manager=from_tool_migration_manager)
tool_dependencies=tool_dependencies)
except Exception as e:
error_message = "Error installing tool dependency %s version %s: %s" % \
(str(name), str(version), str(e))
Expand Down Expand Up @@ -273,7 +270,7 @@ def install_via_fabric(self, tool_shed_repository, tool_dependency, install_dir,
actions_dict)
return tool_dependency

def install_package(self, elem, tool_shed_repository, tool_dependencies=None, from_tool_migration_manager=False):
def install_package(self, elem, tool_shed_repository, tool_dependencies=None):
"""
Install a tool dependency package defined by the XML element elem. The value of tool_dependencies is
a partial or full list of ToolDependency records associated with the tool_shed_repository.
Expand All @@ -296,7 +293,6 @@ def install_package(self, elem, tool_shed_repository, tool_dependencies=None, fr
package_elem,
package_name,
package_version,
from_tool_migration_manager=from_tool_migration_manager,
tool_dependency_db_records=None)
if proceed_with_install and actions_elem_tuples:
# Get the installation directory for tool dependencies that will be installed for the received
Expand Down Expand Up @@ -955,8 +951,7 @@ def install_tool_shed_repository(self, tool_shed_repository, repo_info_dict, too
itdm = InstallToolDependencyManager(self.app)
itdm.install_specified_tool_dependencies(tool_shed_repository=tool_shed_repository,
tool_dependencies_config=tool_dependencies_config,
tool_dependencies=tool_shed_repository.tool_dependencies,
from_tool_migration_manager=False)
tool_dependencies=tool_shed_repository.tool_dependencies)
basic_util.remove_dir(work_dir)
self.update_tool_shed_repository_status(tool_shed_repository,
self.install_model.ToolShedRepository.installation_status.INSTALLED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,14 @@ def get_tag_handler_by_tag(self, tag):
return self.tag_handlers.get(tag, None)

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
tag_handler = self.get_tag_handler_by_tag(package_elem.tag)
tool_dependency, proceed_with_install, action_elem_tuples = \
tag_handler.process_tag_set(tool_shed_repository,
tool_dependency,
package_elem,
package_name,
package_version,
from_tool_migration_manager=from_tool_migration_manager,
tool_dependency_db_records=tool_dependency_db_records)
return tool_dependency, proceed_with_install, action_elem_tuples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RecipeTag:
"""Abstract class that defines a standard format for handling recipe tags when installing packages."""

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
raise Exception("Unimplemented Method")


Expand Down Expand Up @@ -115,7 +115,7 @@ def __init__(self, app):
self.tag = 'install'

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
# <install version="1.0">
# Get the installation directory for tool dependencies that will be installed for the received tool_shed_repository.
actions_elem_tuples = []
Expand All @@ -129,27 +129,17 @@ def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, p
tool_dependency_name=package_name,
tool_dependency_version=package_version)
if os.path.exists(install_dir):
# The tool_migration_manager handles tool migration stages and the sync_database_with_file_system()
# method handles two scenarios: (1) where a Galaxy file system environment related to installed
# Tool Shed repositories and tool dependencies has somehow gotten out of sync with the Galaxy
# database tables associated with these installed items, and (2) the Tool Shed's install and test
# framework which installs repositories in 2 stages, those of type tool_dependency_definition
# followed by those containing valid tools and tool functional test components. Neither of these
# scenarios apply when the install manager is running.
if from_tool_migration_manager:
proceed_with_install = True
else:
# Notice that we'll throw away the following tool_dependency if it can be installed.
tool_dependency, proceed_with_install = self.sync_database_with_file_system(self.app,
tool_shed_repository,
package_name,
package_version,
install_dir,
tool_dependency_type='package')
if not proceed_with_install:
log.debug("Tool dependency %s version %s cannot be installed (it was probably previously installed), so returning it." %
(str(tool_dependency.name), str(tool_dependency.version)))
return tool_dependency, proceed_with_install, actions_elem_tuples
# Notice that we'll throw away the following tool_dependency if it can be installed.
tool_dependency, proceed_with_install = self.sync_database_with_file_system(self.app,
tool_shed_repository,
package_name,
package_version,
install_dir,
tool_dependency_type='package')
if not proceed_with_install:
log.debug("Tool dependency %s version %s cannot be installed (it was probably previously installed), so returning it." %
(str(tool_dependency.name), str(tool_dependency.version)))
return tool_dependency, proceed_with_install, actions_elem_tuples
else:
proceed_with_install = True
if proceed_with_install:
Expand Down Expand Up @@ -194,7 +184,7 @@ def __init__(self, app):
self.tag = 'package'

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
action_elem_tuples = []
proceed_with_install = False
# Only install the tool_dependency if it is not already installed and it is associated with a database
Expand Down Expand Up @@ -225,7 +215,7 @@ def __init__(self, app):
self.tag = 'readme'

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
# Nothing to be done.
action_elem_tuples = []
proceed_with_install = False
Expand Down Expand Up @@ -358,8 +348,7 @@ def get_required_repository_package_env_sh_path(self, package_name, package_vers
env_sh_file_path = os.path.join(env_sh_file_dir, 'env.sh')
return env_sh_file_path

def handle_complex_repository_dependency_for_package(self, elem, package_name, package_version, tool_shed_repository,
from_tool_migration_manager=False):
def handle_complex_repository_dependency_for_package(self, elem, package_name, package_version, tool_shed_repository):
"""
Inspect the repository defined by a complex repository dependency definition and take certain steps to
enable installation of the received package name and version to proceed. The received elem is the
Expand Down Expand Up @@ -400,28 +389,18 @@ def handle_complex_repository_dependency_for_package(self, elem, package_name, p
tool_dependency_name=package_name,
tool_dependency_version=package_version)
if os.path.exists(dependent_install_dir):
# The install manager handles tool migration stages and the sync_database_with_file_system()
# method handles two scenarios: (1) where a Galaxy file system environment related to installed
# Tool Shed repositories and tool dependencies has somehow gotten out of sync with the Galaxy
# database tables associated with these installed items, and (2) the Tool Shed's install and test
# framework which installs repositories in 2 stages, those of type tool_dependency_definition
# followed by those containing valid tools and tool functional test components. Neither of these
# scenarios apply when the install manager is running.
if from_tool_migration_manager:
can_install_tool_dependency = True
else:
# Notice that we'll throw away the following tool_dependency if it can be installed.
tool_dependency, can_install_tool_dependency = self.sync_database_with_file_system(self.app,
tool_shed_repository,
package_name,
package_version,
dependent_install_dir,
tool_dependency_type='package')
if not can_install_tool_dependency:
log.debug("Tool dependency %s version %s cannot be installed (it was probably previously installed), "
"so appending it to the list of handled tool dependencies.",
str(tool_dependency.name), str(tool_dependency.version))
handled_tool_dependencies.append(tool_dependency)
# Notice that we'll throw away the following tool_dependency if it can be installed.
tool_dependency, can_install_tool_dependency = self.sync_database_with_file_system(self.app,
tool_shed_repository,
package_name,
package_version,
dependent_install_dir,
tool_dependency_type='package')
if not can_install_tool_dependency:
log.debug("Tool dependency %s version %s cannot be installed (it was probably previously installed), "
"so appending it to the list of handled tool dependencies.",
str(tool_dependency.name), str(tool_dependency.version))
handled_tool_dependencies.append(tool_dependency)
else:
can_install_tool_dependency = True
if can_install_tool_dependency:
Expand Down Expand Up @@ -476,15 +455,14 @@ def handle_complex_repository_dependency_for_package(self, elem, package_name, p
return handled_tool_dependencies

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
# We have a complex repository dependency definition.
action_elem_tuples = []
proceed_with_install = False
rd_tool_dependencies = self.handle_complex_repository_dependency_for_package(package_elem,
package_name,
package_version,
tool_shed_repository,
from_tool_migration_manager=from_tool_migration_manager)
tool_shed_repository)
for rd_tool_dependency in rd_tool_dependencies:
if rd_tool_dependency.status == self.app.install_model.ToolDependency.installation_status.ERROR:
# We'll log the error here, but continue installing packages since some may not require this dependency.
Expand All @@ -508,7 +486,7 @@ def __init__(self, app):
self.tag = 'set_environment'

def process_tag_set(self, tool_shed_repository, tool_dependency, package_elem, package_name, package_version,
from_tool_migration_manager=False, tool_dependency_db_records=None):
tool_dependency_db_records=None):
# We need to handle two tag sets for package_elem here, this:
# <set_environment version="1.0">
# <environment_variable name="R_SCRIPT_PATH"action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
Expand Down
Loading

0 comments on commit 3fe5d60

Please sign in to comment.