diff --git a/doc/source/admin/file_source_templates.png b/doc/source/admin/file_source_templates.png index 0e57efd51048..8e3c3fabe39e 100644 Binary files a/doc/source/admin/file_source_templates.png and b/doc/source/admin/file_source_templates.png differ diff --git a/doc/source/admin/file_source_webdav_configuration.png b/doc/source/admin/file_source_webdav_configuration.png index 95c7fd0576af..26ec57bd246d 100644 Binary files a/doc/source/admin/file_source_webdav_configuration.png and b/doc/source/admin/file_source_webdav_configuration.png differ diff --git a/doc/source/admin/file_source_webdav_configuration_template.png b/doc/source/admin/file_source_webdav_configuration_template.png index 2898c14849d8..4684e8f05b8a 100644 Binary files a/doc/source/admin/file_source_webdav_configuration_template.png and b/doc/source/admin/file_source_webdav_configuration_template.png differ diff --git a/lib/galaxy/config/__init__.py b/lib/galaxy/config/__init__.py index 554018472dc9..796d83349b5b 100644 --- a/lib/galaxy/config/__init__.py +++ b/lib/galaxy/config/__init__.py @@ -740,6 +740,7 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin): user_tool_section_filters: List[str] visualization_plugins_directory: str workflow_resource_params_mapper: str + file_source_temp_dir: str def __init__(self, **kwargs): super().__init__(**kwargs) @@ -1200,6 +1201,9 @@ def _load_theme(path: str, theme_dict: dict): else: _load_theme(self.themes_config_file, self.themes) + if self.file_source_temp_dir: + self.file_source_temp_dir = os.path.abspath(self.file_source_temp_dir) + def _process_celery_config(self): if self.celery_conf and self.celery_conf.get("result_backend") is None: # If the result_backend is not set, use a SQLite database in the data directory @@ -1310,6 +1314,7 @@ def check(self): self.template_cache_path, self.tool_data_path, self.user_library_import_dir, + self.file_source_temp_dir, ] for path in paths_to_check: self._ensure_directory(path) diff --git a/lib/galaxy/config/sample/galaxy.yml.sample b/lib/galaxy/config/sample/galaxy.yml.sample index a09b781abebe..7269d9fbbee9 100644 --- a/lib/galaxy/config/sample/galaxy.yml.sample +++ b/lib/galaxy/config/sample/galaxy.yml.sample @@ -697,6 +697,11 @@ galaxy: # cleaned up in default Celery task configuration. #short_term_storage_cleanup_interval: 3600 + # The file_source_temp_dir is a temporary directory used by file sources + # that require temporary storage for file operations. + # Defaults to new_file_path. + #file_source_temp_dir: null + # Configured FileSource plugins. # The value of this option will be resolved with respect to # . diff --git a/lib/galaxy/config/schemas/config_schema.yml b/lib/galaxy/config/schemas/config_schema.yml index 0fba005c5e39..c3244b23c9f7 100644 --- a/lib/galaxy/config/schemas/config_schema.yml +++ b/lib/galaxy/config/schemas/config_schema.yml @@ -4075,3 +4075,9 @@ mapping: per_host: true desc: | Enable the integration of the Galaxy Help Forum in the tool panel. This requires the help_forum_api_url to be set. + + file_source_temp_dir: + type: str + required: false + desc: | + Directory to store temporary files for file sources. This defaults to new_file_path if not set. diff --git a/lib/galaxy/files/sources/webdav.py b/lib/galaxy/files/sources/webdav.py index 2e11a51d98b2..036496efdd23 100644 --- a/lib/galaxy/files/sources/webdav.py +++ b/lib/galaxy/files/sources/webdav.py @@ -3,12 +3,12 @@ except ImportError: WebDAVFS = None -import tempfile from typing import ( Optional, Union, ) +from galaxy import config from . import ( FilesSourceOptions, FilesSourceProperties, @@ -23,11 +23,17 @@ class WebDavFilesSource(PyFilesystem2FilesSource): def _open_fs(self, user_context=None, opts: Optional[FilesSourceOptions] = None): props = self._serialization_props(user_context) - use_temp_files = props.pop("use_temp_files", None) - if use_temp_files is None: - # Default to True to avoid memory issues with large files. - props["use_temp_files"] = True - props["temp_path"] = props.get("temp_path", tempfile.TemporaryDirectory(prefix="webdav_")) + + # Check if 'use_temp_files' and 'temp_path' are set in the config, otherwise fallback + props["use_temp_files"] = getattr(config, 'webdav_use_temp_files', True) + temp_path = getattr(config, 'file_source_temp_dir', None) + + if temp_path is None: + # Fallback to props value or use new_file_path from config + new_file_path = getattr(config, 'new_file_path') + temp_path = props.get("temp_path", new_file_path) + props["temp_path"] = temp_path + extra_props: Union[FilesSourceProperties, dict] = opts.extra_props or {} if opts else {} handle = WebDAVFS(**{**props, **extra_props}) return handle diff --git a/lib/galaxy/files/templates/examples/production_webdav.yml b/lib/galaxy/files/templates/examples/production_webdav.yml index eb98ea28ef39..0767dc550867 100644 --- a/lib/galaxy/files/templates/examples/production_webdav.yml +++ b/lib/galaxy/files/templates/examples/production_webdav.yml @@ -40,4 +40,3 @@ login: '{{ variables.login }}' writable: '{{ variables.writable }}' password: '{{ secrets.password }}' - temp_path: null # Uses /tmp as default, configure it if needed diff --git a/lib/galaxy/files/templates/models.py b/lib/galaxy/files/templates/models.py index 06537603e31d..576e31d93b28 100644 --- a/lib/galaxy/files/templates/models.py +++ b/lib/galaxy/files/templates/models.py @@ -111,7 +111,6 @@ class WebdavFileSourceTemplateConfiguration(StrictModel): login: Union[str, TemplateExpansion] password: Union[str, TemplateExpansion] writable: Union[bool, TemplateExpansion] = False - temp_path: Optional[Union[str, TemplateExpansion]] = None template_start: Optional[str] = None template_end: Optional[str] = None @@ -123,7 +122,6 @@ class WebdavFileSourceConfiguration(StrictModel): login: str password: str writable: bool = False - temp_path: Optional[str] = None FileSourceTemplateConfiguration = Union[