Skip to content

Commit 7fda731

Browse files
committed
Don't write to database operation outputs
without making a copy first. These are probably unmodified inputs.
1 parent 5566adf commit 7fda731

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/galaxy/model/__init__.py

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

49494949
quota_source_label = property(get_quota_source_label)
49504950

4951-
def set_skipped(self, object_store_populator: "ObjectStorePopulator") -> None:
4951+
def set_skipped(self, object_store_populator: "ObjectStorePopulator", replace_dataset: bool) -> None:
49524952
assert self.dataset
49534953
object_store_populator.set_object_store_id(self)
4954+
if replace_dataset:
4955+
replacement = Dataset(state=Dataset.states.NEW)
4956+
replacement.object_store_id = self.dataset.object_store_id
4957+
self.dataset = replacement
4958+
self.dataset_id = None
4959+
self.dataset.object_store.create(self.dataset)
49544960
self.extension = "expression.json"
49554961
self.state = self.states.OK
49564962
self.blurb = "skipped"

lib/galaxy/tools/actions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def handle_output(name, output, hidden=None):
737737
hdca.collection.mark_as_populated()
738738
object_store_populator = ObjectStorePopulator(trans.app, trans.user)
739739
for data in out_data.values():
740-
data.set_skipped(object_store_populator)
740+
data.set_skipped(object_store_populator, replace_dataset=False)
741741
job.preferred_object_store_id = preferred_object_store_id
742742
self._record_inputs(trans, tool, job, incoming, inp_data, inp_dataset_collections)
743743
self._record_outputs(job, out_data, output_collections)

lib/galaxy/tools/actions/model_operations.py

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

0 commit comments

Comments
 (0)