From 1e4c53b711e52a551ca4752eabd2266a288549a4 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Thu, 7 Dec 2023 15:21:32 +0100 Subject: [PATCH] Shorten job_to_output_dataset_assocation.name for discovered outputs by using an index instead of an arbitrary name. These outputs don't exist in the tool like output datasets, so I don't think the association name attribute matters. --- lib/galaxy/job_execution/output_collect.py | 2 +- lib/galaxy/model/store/discover.py | 7 ++++--- test/unit/app/tools/test_collect_primary_datasets.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/job_execution/output_collect.py b/lib/galaxy/job_execution/output_collect.py index 508e5f3bb86a..e664b70ec067 100644 --- a/lib/galaxy/job_execution/output_collect.py +++ b/lib/galaxy/job_execution/output_collect.py @@ -543,7 +543,7 @@ def collect_primary_datasets(job_context: Union[JobContext, SessionlessJobContex storage_callbacks=storage_callbacks, ) # Associate new dataset with job - job_context.add_output_dataset_association(f"__new_primary_file_{name}|{designation}__", primary_data) + job_context.add_output_dataset_association(f"__new_primary_file_{name}|{filename_index}__", primary_data) job_context.add_datasets_to_history([primary_data], for_output_dataset=outdata) # Add dataset to return dict primary_datasets[name][designation] = primary_data diff --git a/lib/galaxy/model/store/discover.py b/lib/galaxy/model/store/discover.py index 634ce6048eec..02480391abff 100644 --- a/lib/galaxy/model/store/discover.py +++ b/lib/galaxy/model/store/discover.py @@ -369,15 +369,16 @@ def _populate_elements(self, chunk, name, root_collection_builder, metadata_sour element_datasets["paths"].append(filename) self.add_tags_to_datasets(datasets=element_datasets["datasets"], tag_lists=element_datasets["tag_lists"]) - for element_identifiers, dataset in zip(element_datasets["element_identifiers"], element_datasets["datasets"]): + for i, (element_identifiers, dataset) in enumerate( + zip(element_datasets["element_identifiers"], element_datasets["datasets"]) + ): current_builder = root_collection_builder for element_identifier in element_identifiers[:-1]: current_builder = current_builder.get_level(element_identifier) current_builder.add_dataset(element_identifiers[-1], dataset) # Associate new dataset with job - element_identifier_str = ":".join(element_identifiers) - association_name = f"__new_primary_file_{name}|{element_identifier_str}__" + association_name = f"__new_primary_file_{name}|{i}__" self.add_output_dataset_association(association_name, dataset) add_datasets_timer = ExecutionTimer() diff --git a/test/unit/app/tools/test_collect_primary_datasets.py b/test/unit/app/tools/test_collect_primary_datasets.py index 40618ca9207b..4b82bcecc023 100644 --- a/test/unit/app/tools/test_collect_primary_datasets.py +++ b/test/unit/app/tools/test_collect_primary_datasets.py @@ -234,7 +234,7 @@ def test_job_param(self): self._collect_default_extra() assert len(self.job.output_datasets) == 2 extra_job_assoc = [job_assoc for job_assoc in self.job.output_datasets if job_assoc.name.startswith("__")][0] - assert extra_job_assoc.name == "__new_primary_file_out1|test1__" + assert extra_job_assoc.name == "__new_primary_file_out1|0__" def test_pattern_override_designation(self): self._replace_output_collectors(