Skip to content

Commit

Permalink
Cleanup updating stored_workflow attributes in workflows manager.
Browse files Browse the repository at this point in the history
The ever careless @jmchilton did the same thing in two slightly different ways between galaxyproject#10988 and galaxyproject#11001 - creating his own bizarre race condition.
  • Loading branch information
jmchilton committed Dec 30, 2020
1 parent c2b1b87 commit a45cdbd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
10 changes: 1 addition & 9 deletions lib/galaxy/managers/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,18 +413,11 @@ def update_workflow_from_raw_description(self, trans, stored_workflow, raw_workf
errors.append("Step %i: Requires tool '%s'." % (int(missing_tool_tup[3]) + 1, missing_tool_tup[0]))
raise MissingToolsException(workflow, errors)

as_dict = raw_workflow_description.as_dict
if 'name' in as_dict:
sanitized_name = sanitize_html(as_dict['name'])
workflow.name = sanitized_name
stored_workflow.name = sanitized_name

# Connect up
workflow.stored_workflow = stored_workflow
stored_workflow.latest_workflow = workflow

# I'm not sure we can't just default this to True.
if kwds.get("update_stored_workflow_attributes", False):
if kwds.get("update_stored_workflow_attributes", True):
update_dict = raw_workflow_description.as_dict
if 'name' in update_dict:
stored_workflow.name = update_dict['name']
Expand Down Expand Up @@ -1425,7 +1418,6 @@ def refactor(self, trans, stored_workflow, refactor_request):
stored_workflow,
raw_workflow_description,
fill_defaults=True,
update_stored_workflow_attributes=True,
)


Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/api/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def update(self, trans, id, payload, **kwds):
stored_workflow.published = workflow_dict['published']
trans.sa_session.flush()

if 'annotation' in workflow_dict:
if 'annotation' in workflow_dict and not steps_updated:
newAnnotation = sanitize_html(workflow_dict['annotation'])
self.add_item_annotation(trans.sa_session, trans.get_user(), stored_workflow, newAnnotation)
trans.sa_session.flush()
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/controllers/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ def save_workflow_as(self, trans, workflow_name, workflow_data, workflow_annotat
stored_workflow,
workflow_data,
from_tool_form=from_tool_form,
update_stored_workflow_attributes=False, # taken care of above
)
except workflows.MissingToolsException as e:
return dict(
Expand Down

0 comments on commit a45cdbd

Please sign in to comment.