kestra-io / kestra

:zap: Workflow Automation Platform. Orchestrate & Schedule code in any language, run anywhere, 500+ plugins. Alternative to Zapier, Rundeck, Camunda, Airflow...
https://kestra.io
Apache License 2.0
10.45k stars 866 forks source link

Raise a validation error in the UI (and fail an Execution with sensible error message) when `retry.interval` is larger than `maxDuration` #4412

Open aballiet opened 2 months ago

aballiet commented 2 months ago

Describe the issue

Example of retry strategy leading to no retry attempt:

id: show_retry_miss
namespace: dev
description: Save and Execute the flow

tasks:
- id: run_dbt_cloud_job
  type: io.kestra.plugin.core.flow.WorkingDirectory
  retry:
    maxAttempt: 2
    maxDuration: "PT7H"
    type: constant
    interval: "PT12H"
    warningOnRetry: true
  tasks:
    - id: fail
      type: io.kestra.plugin.scripts.shell.Commands
      taskRunner:
        type: io.kestra.plugin.core.runner.Process
      commands:
        - exit 1
image

=> Retry is not applied, flow execution is considered as Failed after first attempt.

Changing params to a valid one works obviously:

  retry:
    maxAttempt: 2
    maxDuration: "PT7H"
    type: constant
    interval: "PT5S"
    warningOnRetry: true

An error on validation should be thrown to the user: interval (specified: PT12H) cannot be greater than maxDuration (specified: PT7H) as NOT retry would be applied in that case

Environment

anna-geller commented 2 months ago

Raise a warning in the UI (and log a warning in the logs) when retry.interval is larger than maxDuration

@loicmathieu you mentioned "there is no validator for the retry object." — are there any other validation rules missing other than this one? if so, we should define what specifically needs to be validated to add all needed validators in one go

aballiet commented 2 months ago

Better an error, reject flow on save IMO

anna-geller commented 2 months ago

yup, this is what was meant by raising a validation error in the UI