diff --git a/config/galaxy.ini.sample b/config/galaxy.ini.sample index f8b80f362ef..b590b8a589c 100644 --- a/config/galaxy.ini.sample +++ b/config/galaxy.ini.sample @@ -206,7 +206,7 @@ paste.app_factory = galaxy.web.buildapp:app_factory #conda_verbose_install_check=False # Set to True to instruct Galaxy to install Conda from the web automatically # if it cannot find a local copy and conda_exec is not configured. -#conda_auto_init = True +#conda_auto_init = False # File containing the Galaxy Tool Sheds that should be made available to # install from in the admin interface (.sample used if default does not exist). diff --git a/doc/source/releases/16.07.rst b/doc/source/releases/16.07.rst index 7ff2fe2b070..35a2577dcd7 100644 --- a/doc/source/releases/16.07.rst +++ b/doc/source/releases/16.07.rst @@ -5,6 +5,8 @@ 16.07 ------------------------------- +.. announce_start + Highlighted Enhancements ------------------------------- diff --git a/lib/galaxy/tools/deps/__init__.py b/lib/galaxy/tools/deps/__init__.py index 65971dfc825..f7afa8e8a65 100644 --- a/lib/galaxy/tools/deps/__init__.py +++ b/lib/galaxy/tools/deps/__init__.py @@ -22,7 +22,7 @@ EXTRA_CONFIG_KWDS = { 'conda_debug': None, 'conda_ensure_channels': 'r,bioconda,iuc', 'conda_auto_install': False, - 'conda_auto_init': True, + 'conda_auto_init': False, } CONFIG_VAL_NOT_FOUND = object() diff --git a/lib/galaxy/tools/deps/resolvers/conda.py b/lib/galaxy/tools/deps/resolvers/conda.py index 6f9f64e0dd7..d2ff051477e 100644 --- a/lib/galaxy/tools/deps/resolvers/conda.py +++ b/lib/galaxy/tools/deps/resolvers/conda.py @@ -56,6 +56,8 @@ class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, In dependency_manager.default_base_path, DEFAULT_BASE_PATH_DIRECTORY ) + self.conda_prefix_parent = os.path.dirname(conda_prefix) + # warning is related to conda problem discussed in https://github.com/galaxyproject/galaxy/issues/2537, remove when that is resolved conda_prefix_warning_length = 50 if len(conda_prefix) >= conda_prefix_warning_length: @@ -104,21 +106,31 @@ class CondaDependencyResolver(DependencyResolver, ListableDependencyResolver, In Make sure that conda is installed, and if conda can't be installed, mark resolver as disabled. We acquire a lock, so that multiple handlers do not attempt to install conda simultaneously. """ - if not os.path.exists(self.dependency_manager.default_base_path): - os.mkdir(self.dependency_manager.default_base_path) - try: - with FileLock(os.path.join(self.dependency_manager.default_base_path, 'conda')): - if not self.conda_context.is_conda_installed(): - if self.auto_init: - if self.conda_context.can_install_conda(): - if install_conda(self.conda_context): - self.disabled = True - log.warning("Conda installation requested and failed.") - else: + target_path = self.conda_prefix_parent + + def _check(): + if not self.conda_context.is_conda_installed(): + if self.auto_init: + if self.conda_context.can_install_conda(): + if install_conda(self.conda_context): self.disabled = True + log.warning("Conda installation requested and failed.") else: self.disabled = True - log.warning("Conda not installed and auto-installation disabled.") + else: + self.disabled = True + log.warning("Conda not installed and auto-installation disabled.") + else: + self.disabled = False + + if not os.path.exists(target_path): + os.mkdir(target_path) + try: + if self.auto_init and os.access(target_path, os.W_OK): + with FileLock(os.path.join(target_path, 'conda')): + _check() + else: + _check() except FileLockException: self.ensure_conda_installed() diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index e23d91b8732..2a2b998b253 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -15,7 +15,6 @@ from galaxy.util import listify from galaxy.util import parse_xml from galaxy.util import string_as_bool from galaxy.util.bunch import Bunch -from galaxy.util.postfork import register_postfork_function from .parser import get_toolbox_parser, ensure_tool_conf_item @@ -104,7 +103,6 @@ class AbstractToolBox( Dictifiable, ManagesIntegratedToolPanelMixin, object ): self._init_tools_from_config( config_filename ) except: log.exception( "Error loading tools defined in config %s", config_filename ) - register_postfork_function(self._tool_conf_watcher.start) def _init_tools_from_config( self, config_filename ): """ diff --git a/lib/galaxy/tools/toolbox/watcher.py b/lib/galaxy/tools/toolbox/watcher.py index 8a84f91df16..f683603c0e5 100644 --- a/lib/galaxy/tools/toolbox/watcher.py +++ b/lib/galaxy/tools/toolbox/watcher.py @@ -74,7 +74,7 @@ class ToolConfWatcher(object): def start(self): if not self._active: self._active = True - self.thread.start() + register_postfork_function(self.thread.start) def shutdown(self): if self._active: @@ -109,6 +109,7 @@ class ToolConfWatcher(object): mod_time = time.ctime(os.path.getmtime(path)) with self._lock: self.paths[path] = mod_time + self.start() def watch_file(self, tool_conf_file): self.monitor(tool_conf_file)