Skip to content

Commit

Permalink
Don't flush for inner elements
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed May 14, 2024
1 parent c1ce0be commit baf7fef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/galaxy/tools/parameters/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,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(app: "MinimalApp", history: "History", as_dict_value: Dict[str, Any]) -> "HistoryItem":
def raw_to_galaxy(app: "MinimalApp", history: "History", as_dict_value: Dict[str, Any], commit=True) -> "HistoryItem":
object_class = as_dict_value["class"]
if object_class == "File":
# TODO: relative_to = "/"
Expand Down Expand Up @@ -2728,7 +2728,8 @@ def raw_to_galaxy(app: "MinimalApp", history: "History", as_dict_value: Dict[str
app.model.session.add(primary_data)
history.stage_addition(primary_data)
history.add_pending_items()
app.model.session.flush()
if commit:
app.model.session.commit()
return primary_data
else:
name = as_dict_value.get("name")
Expand All @@ -2748,7 +2749,8 @@ def write_elements_to_collection(has_elements, collection_builder):
element_class = element_dict["class"]
identifier = element_dict["identifier"]
if element_class == "File":
hda = raw_to_galaxy(app, history, element_dict)
# Don't commit for inner elements
hda = raw_to_galaxy(app, history, element_dict, commit=False)
collection_builder.add_dataset(identifier, hda)
else:
subcollection_builder = collection_builder.get_level(identifier)
Expand All @@ -2759,7 +2761,8 @@ def write_elements_to_collection(has_elements, collection_builder):
collection_builder.populate()
history.stage_addition(hdca)
history.add_pending_items()
app.model.session.flush()
if commit:
app.model.session.commit()
return hdca


Expand Down

0 comments on commit baf7fef

Please sign in to comment.