Skip to content

Commit

Permalink
Merge pull request galaxyproject#18132 from mvdbeek/fix_data_default_…
Browse files Browse the repository at this point in the history
…values_not_getting_added_to_history

[24.0] Fix data default values not getting added to history
  • Loading branch information
jdavcs authored May 14, 2024
2 parents cd47ef6 + 25f8d7e commit e1815c3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2675,7 +2675,7 @@ def to_text(self, value):

# Code from CWL branch to massage in order to be shared across tools and workflows,
# and for CWL artifacts as well as Galaxy ones.
def raw_to_galaxy(trans, as_dict_value):
def raw_to_galaxy(trans, as_dict_value, commit=True):
app = trans.app
history = trans.history

Expand Down Expand Up @@ -2725,7 +2725,8 @@ def raw_to_galaxy(trans, as_dict_value):
trans.sa_session.add(primary_data)
history.stage_addition(primary_data)
history.add_pending_items()
trans.sa_session.flush()
if commit:
app.model.session.commit()
return primary_data
else:
name = as_dict_value.get("name")
Expand All @@ -2737,14 +2738,16 @@ def raw_to_galaxy(trans, as_dict_value):
name=name,
collection=collection,
)
app.model.session.add(hdca)

def write_elements_to_collection(has_elements, collection_builder):
element_dicts = has_elements.get("elements")
for element_dict in element_dicts:
element_class = element_dict["class"]
identifier = element_dict["identifier"]
if element_class == "File":
hda = raw_to_galaxy(trans, element_dict)
# Don't commit for inner elements
hda = raw_to_galaxy(trans, element_dict, commit=False)
collection_builder.add_dataset(identifier, hda)
else:
subcollection_builder = collection_builder.get_level(identifier)
Expand All @@ -2753,8 +2756,10 @@ def write_elements_to_collection(has_elements, collection_builder):
collection_builder = builder.BoundCollectionBuilder(collection)
write_elements_to_collection(as_dict_value, collection_builder)
collection_builder.populate()
trans.sa_session.add(hdca)
trans.sa_session.flush()
history.stage_addition(hdca)
history.add_pending_items()
if commit:
app.model.session.commit()
return hdca


Expand Down

0 comments on commit e1815c3

Please sign in to comment.