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.1] Fix importing shared workflows with deeply nested subworkflows #19335

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 5 additions & 5 deletions lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7616,7 +7616,7 @@ class StoredWorkflow(Base, HasTags, Dictifiable, RepresentById, UsesCreateAndUpd
order_by=lambda: -Workflow.id,
cascade_backrefs=False,
)
latest_workflow = relationship(
latest_workflow: Mapped["Workflow"] = relationship(
"Workflow",
post_update=True,
primaryjoin=(lambda: StoredWorkflow.latest_workflow_id == Workflow.id),
Expand Down Expand Up @@ -7722,7 +7722,7 @@ def show_in_tool_panel(self, user_id):
)
return bool(sa_session.scalar(stmt))

def copy_tags_from(self, target_user, source_workflow):
def copy_tags_from(self, target_user, source_workflow: "StoredWorkflow"):
# Override to only copy owner tags.
for src_swta in source_workflow.owner_tags:
new_swta = src_swta.copy()
Expand Down Expand Up @@ -8238,10 +8238,10 @@ def copy_to(self, copied_step, step_mapping, user=None):
copied_step.subworkflow = subworkflow
copied_subworkflow = subworkflow
else:
# Can this even happen, building a workflow with a subworkflow you don't own ?
copied_subworkflow = subworkflow.copy()
# Importing a shared workflow with a subworkflow step
copied_subworkflow = subworkflow.copy(user=user)
nsoranzo marked this conversation as resolved.
Show resolved Hide resolved
stored_workflow = StoredWorkflow(
user, name=copied_subworkflow.name, workflow=copied_subworkflow, hidden=True
user=user, name=copied_subworkflow.name, workflow=copied_subworkflow, hidden=True
)
copied_subworkflow.stored_workflow = stored_workflow
copied_step.subworkflow = copied_subworkflow
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/base/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ def get_stored_workflow_steps(self, trans, stored_workflow: model.StoredWorkflow
except exceptions.ToolMissingException:
pass

def _import_shared_workflow(self, trans, stored):
def _import_shared_workflow(self, trans, stored: model.StoredWorkflow):
"""Imports a shared workflow"""
# Copy workflow.
imported_stored = model.StoredWorkflow()
Expand Down
Loading