mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Use resolver to explicitly install dependencies
This avoids replicating the resolver logic when installing dependencies and should be better than https://github.com/jmchilton/galaxy/pull/52
This commit is contained in:
@@ -145,7 +145,7 @@ class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, In
|
||||
dependencies = []
|
||||
|
||||
is_installed = self.conda_context.has_env(env)
|
||||
if not is_installed and self.auto_install:
|
||||
if not is_installed and (self.auto_install or kwds.get('install', False)):
|
||||
is_installed = self.install_all(conda_targets)
|
||||
|
||||
if is_installed:
|
||||
@@ -191,7 +191,7 @@ class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, In
|
||||
preserve_python_environment = kwds.get("preserve_python_environment", False)
|
||||
|
||||
job_directory = kwds.get("job_directory", None)
|
||||
if not is_installed and self.auto_install and job_directory:
|
||||
if not is_installed and (self.auto_install or kwds.get('install', False)):
|
||||
is_installed = self.install_dependency(name=name, version=version, type=type)
|
||||
|
||||
if not is_installed:
|
||||
|
||||
@@ -45,6 +45,9 @@ class DependencyResolversView(object):
|
||||
def resolver_dependency(self, index, **kwds):
|
||||
return self._dependency(**kwds)
|
||||
|
||||
def install_dependencies(self, requirements):
|
||||
return self._dependency_manager._requirements_to_dependencies_dict(requirements, **{'install': True})
|
||||
|
||||
def install_dependency(self, index=None, **payload):
|
||||
"""
|
||||
Installs dependency using highest priority resolver that supports dependency installation
|
||||
|
||||
@@ -141,11 +141,11 @@ class ToolsController( BaseAPIController, UsesVisualizationMixin ):
|
||||
force_rebuild: If true and chache dir exists, attempts to delete cache dir
|
||||
"""
|
||||
tool = self._get_tool(id)
|
||||
[tool._view.install_dependency(id=None, **req.to_dict()) for req in tool.requirements]
|
||||
tool._view.install_dependencies(tool.requirements)
|
||||
if kwds.get('build_dependency_cache'):
|
||||
tool.build_dependency_cache(**kwds)
|
||||
# TODO: rework resolver install system to log and report what has been done.
|
||||
# _view.install_dependency should return a dict with stdout, stderr and success status
|
||||
# _view.install_dependencies should return a dict with stdout, stderr and success status
|
||||
return tool.tool_requirements_status
|
||||
|
||||
@expose_api
|
||||
|
||||
@@ -905,15 +905,15 @@ class InstallRepositoryManager( object ):
|
||||
if 'tools' in metadata and install_resolver_dependencies:
|
||||
self.update_tool_shed_repository_status( tool_shed_repository,
|
||||
self.install_model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES )
|
||||
requirements = suc.get_unique_requirements_from_repository(tool_shed_repository)
|
||||
[self._view.install_dependency(id=None, **req) for req in requirements]
|
||||
if self.app.config.use_cached_dependency_manager:
|
||||
cached_requirements = []
|
||||
for tool_d in metadata['tools']:
|
||||
tool = self.app.toolbox._tools_by_id.get(tool_d['guid'], None)
|
||||
if tool and tool.requirements not in cached_requirements:
|
||||
cached_requirements.append(tool.requirements)
|
||||
installed_requirements = []
|
||||
for tool_d in metadata['tools']:
|
||||
tool = self.app.toolbox._tools_by_id.get(tool_d['guid'], None)
|
||||
if tool and tool.requirements not in installed_requirements:
|
||||
self._view.install_dependencies(tool.requirements)
|
||||
installed_requirements.append(tool.requirements)
|
||||
if self.app.config.use_cached_dependency_manager:
|
||||
tool.build_dependency_cache()
|
||||
|
||||
if install_tool_dependencies and tool_shed_repository.tool_dependencies and 'tool_dependencies' in metadata:
|
||||
work_dir = tempfile.mkdtemp( prefix="tmp-toolshed-itsr" )
|
||||
# Install tool dependencies.
|
||||
|
||||
Reference in New Issue
Block a user