diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index f0a3b589ee3..1448ce6f75e 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -2184,6 +2184,10 @@ class Dataset(StorableObject, RepresentById): else: return os.path.abspath(self.external_extra_files_path) + def create_extra_files_path(self): + if not self.extra_files_path_exists(): + self.object_store.create(self, dir_only=True, extra_dir=self._extra_files_rel_path) + def set_extra_files_path(self, extra_files_path): if not extra_files_path: self.external_extra_files_path = None diff --git a/lib/galaxy/tools/parameters/output_collect.py b/lib/galaxy/tools/parameters/output_collect.py index caca15031cd..81c10a8d22d 100644 --- a/lib/galaxy/tools/parameters/output_collect.py +++ b/lib/galaxy/tools/parameters/output_collect.py @@ -316,6 +316,7 @@ def collect_primary_datasets(job_context, output, input_ext): extra_files_path = new_primary_datasets_attributes.get('extra_files', None) if extra_files_path: extra_files_path_joined = os.path.join(job_working_directory, extra_files_path) + primary_data.dataset.create_extra_files_path() for root, dirs, files in os.walk(extra_files_path_joined): extra_dir = os.path.join(primary_data.extra_files_path, root.replace(extra_files_path_joined, '', 1).lstrip(os.path.sep)) extra_dir = os.path.normpath(extra_dir) diff --git a/test/unit/test_model_store.py b/test/unit/test_model_store.py index ec2cb414c99..4f26f5b2574 100644 --- a/test/unit/test_model_store.py +++ b/test/unit/test_model_store.py @@ -283,7 +283,7 @@ def test_import_export_composite_datasets(): h = model.History(name="Test History", user=u) d1 = _create_datasets(sa_session, h, 1, extension="html")[0] - app.object_store.create(d1.dataset, dir_only=True, extra_dir=d1.dataset._extra_files_rel_path) + d1.dataset.create_extra_files_path() sa_session.add_all((h, d1)) sa_session.flush()