mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #3358 from jmchilton/dev_merge
Merge latest release 16.10 into dev.
This commit is contained in:
@@ -399,6 +399,16 @@ class Tool( object, Dictifiable ):
|
||||
def valid_input_states( self ):
|
||||
return model.Dataset.valid_input_states
|
||||
|
||||
@property
|
||||
def requires_galaxy_python_environment(self):
|
||||
"""Indicates this tool's runtime requires Galaxy's Python environment."""
|
||||
# All special tool types (data source, history import/export, etc...)
|
||||
# seem to require Galaxy's Python.
|
||||
return self.tool_type != "default" or self.id in [
|
||||
"__SET_METADATA__",
|
||||
"upload1",
|
||||
]
|
||||
|
||||
def __get_job_tool_configuration(self, job_params=None):
|
||||
"""Generalized method for getting this tool's job configuration.
|
||||
|
||||
@@ -1327,6 +1337,7 @@ class Tool( object, Dictifiable ):
|
||||
installed_tool_dependencies=self.installed_tool_dependencies,
|
||||
tool_dir=self.tool_dir,
|
||||
job_directory=job_directory,
|
||||
preserve_python_environment=self.requires_galaxy_python_environment,
|
||||
metadata=metadata,
|
||||
tool_instance=self
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ class ExplicitContainerResolver(ContainerResolver):
|
||||
a correct container.
|
||||
"""
|
||||
for container_description in tool_info.container_descriptions:
|
||||
if self._container_type_enabled(container_description):
|
||||
return True
|
||||
if self._container_type_enabled(container_description, enabled_container_types):
|
||||
return container_description
|
||||
|
||||
return False
|
||||
return None
|
||||
|
||||
@@ -120,6 +120,8 @@ class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, In
|
||||
conda_target, conda_context=self.conda_context
|
||||
)
|
||||
|
||||
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:
|
||||
is_installed = self.install_dependency(name=name, version=version, type=type)
|
||||
@@ -144,7 +146,8 @@ class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, In
|
||||
conda_environment,
|
||||
exact,
|
||||
name,
|
||||
version
|
||||
version,
|
||||
preserve_python_environment=preserve_python_environment,
|
||||
)
|
||||
|
||||
def list_dependencies(self):
|
||||
@@ -195,7 +198,7 @@ class CondaDependency(Dependency):
|
||||
dependency_type = 'conda'
|
||||
cacheable = True
|
||||
|
||||
def __init__(self, conda_context, environment_path, exact, name=None, version=None):
|
||||
def __init__(self, conda_context, environment_path, exact, name=None, version=None, preserve_python_environment=False):
|
||||
self.activate = conda_context.activate
|
||||
self.conda_context = conda_context
|
||||
self.environment_path = environment_path
|
||||
@@ -203,6 +206,7 @@ class CondaDependency(Dependency):
|
||||
self._name = name
|
||||
self._version = version
|
||||
self.cache_path = None
|
||||
self._preserve_python_environment = preserve_python_environment
|
||||
|
||||
@property
|
||||
def exact(self):
|
||||
@@ -243,11 +247,19 @@ class CondaDependency(Dependency):
|
||||
if not self.cache_path:
|
||||
# Build an isolated environment if not using a cached dependency manager
|
||||
self.build_environment()
|
||||
return """[ "$CONDA_DEFAULT_ENV" = "%s" ] || . %s '%s' > conda_activate.log 2>&1 """ % (
|
||||
self.environment_path,
|
||||
self.activate,
|
||||
self.environment_path
|
||||
)
|
||||
if self._preserve_python_environment:
|
||||
# On explicit testing the only such requirement I am aware of is samtools - and it seems to work
|
||||
# fine with just appending the PATH as done below. Other tools may require additional
|
||||
# variables in the future.
|
||||
return """export PATH=$PATH:'%s/bin' """ % (
|
||||
self.environment_path,
|
||||
)
|
||||
else:
|
||||
return """[ "$CONDA_DEFAULT_ENV" = "%s" ] || . %s '%s' > conda_activate.log 2>&1 """ % (
|
||||
self.environment_path,
|
||||
self.activate,
|
||||
self.environment_path
|
||||
)
|
||||
|
||||
|
||||
def _string_as_bool( value ):
|
||||
|
||||
Reference in New Issue
Block a user