From 284f7bc46b97408e65b89f1dfed9e06d2080018c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 13 May 2019 18:28:36 +0200 Subject: [PATCH] Rework delaying/cancelling workflow evalation with non-data inputs We try to fail early if any (expression.json) dataset in a dataset collection is not OK. Probably cheaper then delaying execution many times. --- lib/galaxy/workflow/run.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/galaxy/workflow/run.py b/lib/galaxy/workflow/run.py index 2db758a3d59..a504c4ecf65 100644 --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -368,17 +368,22 @@ class WorkflowProgress(object): delayed_why = "dependent collection [%s] not yet populated with datasets" % replacement.id raise modules.DelayedWorkflowEvaluation(why=delayed_why) - if not is_data: + data_inputs = (model.HistoryDatasetAssociation, model.HistoryDatasetCollectionAssociation, model.DatasetCollection) + if not is_data and isinstance(replacement, data_inputs): if isinstance(replacement, model.HistoryDatasetAssociation): - if replacement.is_ok: - return replacement - elif replacement.is_pending: - raise modules.DelayedWorkflowEvaluation() - elif isinstance(replacement, (model.HistoryDatasetCollectionAssociation, model.DatasetCollection)): - if any((_.is_pending for _ in replacement.dataset_instances)): + if replacement.is_pending: raise modules.DelayedWorkflowEvaluation() + if not replacement.is_ok: + raise modules.CancelWorkflowEvaluation() else: - raise modules.CancelWorkflowEvaluation() + pending = False + for dataset_instance in replacement.dataset_instances: + if dataset_instance.is_pending: + pending = True + elif not dataset_instance.is_ok: + raise modules.CancelWorkflowEvaluation() + if pending: + raise modules.DelayedWorkflowEvaluation() return replacement