From 6d200fb46ed841bdeadcf708ed1878c7eaa84697 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 14 Oct 2026 23:01:48 +0200 Subject: [PATCH] Tolerate a config directory created concurrently by another process Tool shed servers started by parallel pytest-xdist workers all create the same compiled template directory; whichever lost the race failed to start with 'File exists'. --- lib/galaxy/config/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index e31e63417b5..4aa8d890d81 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -691,7 +691,8 @@ class CommonConfigurationMixin: def _ensure_directory(self, path): if path not in [None, False] and not os.path.isdir(path): try: - os.makedirs(path) + # Another process starting with the same configuration may create it first. + os.makedirs(path, exist_ok=True) except Exception as e: raise ConfigurationError(f"Unable to create missing directory: {path}\n{unicodify(e)}")