Skip to content

Commit

Permalink
Fix WorkflowProgress.replacement_for_connection() typing
Browse files Browse the repository at this point in the history
The code wouldn't currently work if `replacement` is a `DatasetCollection`
because it tries to access the `collection` attribute which is
available only for `HistoryDatasetCollectionAssociation`.
  • Loading branch information
nsoranzo committed Nov 11, 2021
1 parent 14df18a commit 956c476
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/galaxy/workflow/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,16 @@ def replacement_for_connection(self, connection, is_data=True):
delayed_why = f"dependent collection [{replacement.id}] not yet populated with datasets"
raise modules.DelayedWorkflowEvaluation(why=delayed_why)

data_inputs = (model.HistoryDatasetAssociation, model.HistoryDatasetCollectionAssociation, model.DatasetCollection)
if not is_data and isinstance(replacement, data_inputs):
if isinstance(replacement, model.DatasetCollection):
raise NotImplementedError
if not is_data and isinstance(replacement, (model.HistoryDatasetAssociation, model.HistoryDatasetCollectionAssociation)):
if isinstance(replacement, model.HistoryDatasetAssociation):
if replacement.is_pending:
raise modules.DelayedWorkflowEvaluation()
if not replacement.is_ok:
raise modules.CancelWorkflowEvaluation()
else:
if not replacement.collection.populated: # type: ignore
if not replacement.collection.populated:
raise modules.DelayedWorkflowEvaluation()
pending = False
for dataset_instance in replacement.dataset_instances:
Expand Down

1 comment on commit 956c476

@mr-c
Copy link
Contributor

@mr-c mr-c commented on 956c476 Nov 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please sign in to comment.