Skip to content

Commit 2bed907

Browse files
committed
Merge branch 'release_25.0' into release_25.1
2 parents 551300c + b57e5ce commit 2bed907

File tree

4 files changed

+57
-4
lines changed

4 files changed

+57
-4
lines changed

lib/galaxy/model/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5171,9 +5171,15 @@ def get_quota_source_label(self):
51715171

51725172
quota_source_label = property(get_quota_source_label)
51735173

5174-
def set_skipped(self, object_store_populator: "ObjectStorePopulator") -> None:
5174+
def set_skipped(self, object_store_populator: "ObjectStorePopulator", replace_dataset: bool) -> None:
51755175
assert self.dataset
51765176
object_store_populator.set_object_store_id(self)
5177+
if replace_dataset:
5178+
replacement = Dataset(state=Dataset.states.NEW)
5179+
replacement.object_store_id = self.dataset.object_store_id
5180+
self.dataset = replacement
5181+
self.dataset_id = None
5182+
self.dataset.object_store.create(self.dataset)
51775183
self.extension = "expression.json"
51785184
self.state = self.states.OK
51795185
self.blurb = "skipped"

lib/galaxy/tools/actions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ def handle_output(name, output, hidden=None):
742742
hdca.collection.mark_as_populated()
743743
object_store_populator = ObjectStorePopulator(trans.app, trans.user)
744744
for data in out_data.values():
745-
data.set_skipped(object_store_populator)
745+
data.set_skipped(object_store_populator, replace_dataset=False)
746746
job.preferred_object_store_id = preferred_object_store_id
747747
self._handle_credentials_context(trans.sa_session, job, credentials_context)
748748
self._record_inputs(trans, tool, job, incoming, inp_data, inp_dataset_collections)

lib/galaxy/tools/actions/model_operations.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ def _produce_outputs(
180180
object_store_populator = ObjectStorePopulator(trans.app, trans.user)
181181
for hdca in output_collections.out_collection_instances.values():
182182
hdca.visible = False
183-
# Would we also need to replace the datasets with skipped datasets?
184183
for data in hdca.dataset_instances:
185-
data.set_skipped(object_store_populator)
184+
data.set_skipped(object_store_populator, replace_dataset=True)
186185
trans.sa_session.add_all(out_data.values())

lib/galaxy_test/api/test_workflows.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5792,6 +5792,54 @@ def test_run_with_default_file_in_step_inline(self):
57925792
content = self.dataset_populator.get_history_dataset_content(history_id)
57935793
assert "chr1" in content
57945794

5795+
def test_conditional_skip_on_database_operation_collection_output(self):
5796+
with self.dataset_populator.test_history() as history_id:
5797+
summary = self._run_workflow(
5798+
"""
5799+
class: GalaxyWorkflow
5800+
inputs:
5801+
input_collection: collection
5802+
steps:
5803+
filter:
5804+
tool_id: __FILTER_FAILED_DATASETS__
5805+
in:
5806+
input: input_collection
5807+
when: $(false)
5808+
""",
5809+
test_data="""
5810+
input_collection:
5811+
collection_type: list
5812+
elements:
5813+
- identifier: el1
5814+
content: "test content 1"
5815+
""",
5816+
history_id=history_id,
5817+
wait=True,
5818+
assert_ok=True,
5819+
)
5820+
invocation = self.workflow_populator.get_invocation(summary.invocation_id, step_details=True)
5821+
5822+
input_hdca_details = self.dataset_populator.get_history_collection_details(
5823+
history_id, content_id=invocation["inputs"]["0"]["id"]
5824+
)
5825+
input_hda = input_hdca_details["elements"][0]["object"]
5826+
filter_content = self.dataset_populator.get_history_dataset_content(
5827+
history_id=history_id, content_id=input_hda["id"]
5828+
)
5829+
assert "test content 1" in filter_content, f"Expected 'test content 1' in input, got: {filter_content}"
5830+
5831+
# Get the filter step output
5832+
filter_step = [s for s in invocation["steps"] if s["workflow_step_label"] == "filter"][0]
5833+
filter_output_id = filter_step["output_collections"]["output"]["id"]
5834+
hdca = self.dataset_populator.get_history_collection_details(history_id, content_id=filter_output_id)
5835+
hda = hdca["elements"][0]["object"]
5836+
5837+
# Assert that the filter output dataset contains the string 'null'
5838+
filter_content = self.dataset_populator.get_history_dataset_content(
5839+
history_id=history_id, content_id=hda["id"]
5840+
)
5841+
assert "null" in filter_content, f"Expected 'null' in filter output, got: {filter_content}"
5842+
57955843
def test_conditional_flat_crossproduct_subworkflow(self):
57965844
parent = yaml.safe_load(
57975845
"""

0 commit comments

Comments
 (0)