From 53f372aeeec754cfd70f4d1ce52e0b3a37e20c1d Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 30 Sep 2023 08:54:02 +0200 Subject: [PATCH 1/2] Add test for PJA that tags output collection ... from database operation tool. --- lib/galaxy_test/api/test_workflows.py | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/lib/galaxy_test/api/test_workflows.py b/lib/galaxy_test/api/test_workflows.py index f4fcd72dab21..29350f9fea38 100644 --- a/lib/galaxy_test/api/test_workflows.py +++ b/lib/galaxy_test/api/test_workflows.py @@ -5876,6 +5876,44 @@ def test_run_remove_tag_on_collection_output(self): ), details_collection_without_tag assert len(details_collection_without_tag["tags"]) == 0, details_collection_without_tag + @skip_without_tool("collection_creates_pair") + @skip_without_tool("cat") + def test_run_add_tag_on_database_operation_output(self): + with self.dataset_populator.test_history() as history_id: + self._run_jobs( + """ +class: GalaxyWorkflow +inputs: + input1: data_collection +steps: + extrat: + tool_id: __EXTRACT_DATASET__ + in: + input: input1 + outputs: + output: + add_tags: + - "name:foo" +""", + test_data=""" +input1: + collection_type: list + name: the_dataset_list + elements: + - identifier: el1 + value: 1.fastq + type: File +""", + history_id=history_id, + round_trip_format_conversion=True, + ) + details_dataset_with_tag = self.dataset_populator.get_history_dataset_details( + history_id, hid=3, wait=True, assert_ok=True + ) + + assert details_dataset_with_tag["history_content_type"] == "dataset", details_dataset_with_tag + assert details_dataset_with_tag["tags"][0] == "name:foo", details_dataset_with_tag + @skip_without_tool("cat1") def test_run_with_runtime_pja(self): workflow = self.workflow_populator.load_workflow(name="test_for_pja_runtime") From cd9d132ee1f4afa9fd91adca83f54321ceb240f7 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sat, 30 Sep 2023 08:28:03 +0200 Subject: [PATCH 2/2] Fix tag ownership check I think that in the tool evaluation context we don't actually need the cached_id performance tweak: we batch flushes now on map over creation ... which in fact breaks the assumption that we're setting the user id here. --- lib/galaxy/tools/actions/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index 249b34f2b484..391dbbc11434 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -850,6 +850,7 @@ def _new_job_for_session(self, trans, tool, history): job.session_id = model.cached_id(galaxy_session) if trans.user is not None: job.user_id = model.cached_id(trans.user) + job.user = trans.user if history: job.history_id = model.cached_id(history) job.tool_id = tool.id