From 4f3c44f3ad386a667f156f39d1af44bf23b7a8ab Mon Sep 17 00:00:00 2001 From: Nate Coraor Date: Thu, 25 Aug 2016 13:23:36 -0400 Subject: [PATCH 1/5] Move the registration of the start function into the ToolConfWatcher itself so it doesn't have to be called by things that instantiate it. Fixes #2831. --- lib/galaxy/tools/toolbox/base.py | 1 - lib/galaxy/tools/toolbox/watcher.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index e23d91b8732..d127df1fffd 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -104,7 +104,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) From 6631367b7cd4f2049426f3554eef6da626b83837 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Thu, 25 Aug 2016 13:48:58 -0400 Subject: [PATCH 2/5] Unused import, cleanup for #2856 --- lib/galaxy/tools/toolbox/base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index d127df1fffd..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 From 3e65a165b722740b48ece5dab36a2a28cfa7681c Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Thu, 25 Aug 2016 14:32:10 -0400 Subject: [PATCH 3/5] fix inclusion of release notes in announcement --- doc/source/releases/16.07.rst | 2 ++ 1 file changed, 2 insertions(+) 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 ------------------------------- From d1821fed475a4261c007de3627cb3eeb42d53a1f Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Mon, 22 Aug 2016 13:34:18 -0400 Subject: [PATCH 4/5] disable conda_auto_init --- config/galaxy.ini.sample | 2 +- lib/galaxy/tools/deps/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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() From 6724146e7d09e5c0ac4f19d96e600d14831a8abe Mon Sep 17 00:00:00 2001 From: John Chilton Date: Fri, 26 Aug 2016 12:24:11 -0400 Subject: [PATCH 5/5] Fix three conda bugs. - Don't attempt file lock if don't have write access for lock. - Set disabled to False if conda present and auto_init is False. - Use the correct parent path for conda_prefix (if default parent path is overridden). --- lib/galaxy/tools/deps/resolvers/conda.py | 36 ++++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) 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()