kestra icon indicating copy to clipboard operation
kestra copied to clipboard

Enhance multiple conditons with deadline

Open loicmathieu opened this issue 3 months ago • 1 comments

Feature description

Currently, multiple condition for the flow trigger works with a sliding window of execution. This is controlled by the window property with an additional windowAdvance property.

Sliding windows are a powerful concept but may be a bit hard to understand.

We can introduce a concept of deadline, which will always be on a daily basis.

For example, to launch a flow before 9am if flowA and flowB would be successfully executed we would be able to define the following flow trigger (using the new FlowFilters condition):

id: myflow
namespace: company.team

triggers:
  - id: flow
    type: io.kestra.plugin.core.trigger.Flow
    conditions:
      - id: flowFilters
        type: io.kestra.plugin.core.condition.FlowFilters
        deadline: 09:00:00
        upstreamFlows:
          - namespace: company.team
            flowId: low-a
            states: [SUCCESS, WARNING]
          - namespace: company.team
            flowId: flow-b
            states: [SUCCESS]

tasks:
  - id: only
    type: io.kestra.plugin.core.debug.Return
    format: "It works"

We can have the following semantics:

  • deadline: the time at which we want the flow to be triggered.
  • latency: optional, duration to wait for the conditions to be fulfill, by default 1mn (or 0 but it would be handled as 1mn in the executor so we have 1mn to trigger the flow at the deadline).
  • missedBehavior: optional, what to do in case the deadline is missed, by default, nothing. Possible actions NOTHING, EXECUTE_SUCCESS, EXECUTE_FAIL.

loicmathieu avatar Oct 29 '24 14:10 loicmathieu