From 2b21e05f4e1b573bdd732df9354435b500ca0932 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 24 Jul 2024 19:23:08 +0200 Subject: [PATCH] List all info level failure reasons --- lib/galaxy/schema/invocation.py | 15 +++++++++++++++ lib/galaxy/workflow/run.py | 6 ++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/schema/invocation.py b/lib/galaxy/schema/invocation.py index 55bb438ae531..1d433fa5584a 100644 --- a/lib/galaxy/schema/invocation.py +++ b/lib/galaxy/schema/invocation.py @@ -78,6 +78,21 @@ class FailureReason(str, Enum): unexpected_failure = "unexpected_failure" +# The reasons below are attached to the invocation and user-actionable. +# Not included are `unexpected_failure` and `expression_evaluation_failed`. +# If expression evaluation fails we're not attaching the templated +# expression to the invocation, as it could contain secrets. +# If the failure reason is not in `FAILURE_REASONS_EXPECTED` we should +# log an exception so admins can debug and/or submit bug reports. +FAILURE_REASONS_EXPECTED = ( + FailureReason.dataset_failed, + FailureReason.collection_failed, + FailureReason.job_failed, + FailureReason.output_not_found, + FailureReason.when_not_boolean, +) + + class CancelReason(str, Enum): """Possible reasons for a cancelled workflow.""" diff --git a/lib/galaxy/workflow/run.py b/lib/galaxy/workflow/run.py index fbedaef748ce..2addb711cad6 100644 --- a/lib/galaxy/workflow/run.py +++ b/lib/galaxy/workflow/run.py @@ -25,6 +25,7 @@ ) from galaxy.schema.invocation import ( CancelReason, + FAILURE_REASONS_EXPECTED, FailureReason, InvocationCancellationHistoryDeleted, InvocationFailureCollectionFailed, @@ -252,10 +253,7 @@ def invoke(self) -> Dict[int, Any]: self.progress.mark_step_outputs_delayed(step, why=de.why) except Exception as e: log_function = log.exception - if isinstance(e, modules.FailWorkflowEvaluation) and e.why.reason not in ( - "unexpected_failure", - "expression_evaluation_failed", - ): + if isinstance(e, modules.FailWorkflowEvaluation) and e.why.reason in FAILURE_REASONS_EXPECTED: log_function = log.info log_function( "Failed to schedule %s for %s, problem occurred on %s.",