Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Fix data default values not getting added to history #18132

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading