Giter Site home page Giter Site logo

Comments (6)

loicmathieu avatar loicmathieu commented on June 12, 2024 1

@anna-geller for permission, we can do the same as the Flow task: allowed to toggle the trigger if the current flow is allowed to trigger the target flow. If so, we can reuse the existing facility which would speed up development.

from kestra.

anna-geller avatar anna-geller commented on June 12, 2024

this might be a quicker workaround once the state store gets added as a condition:

id: http
namespace: dev

tasks:
  - id: slack
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    payload: |
      {
        "channel": "#general",
        "text": "The price is now: {{ json(trigger.body).price }}"
      }
  
  - id: if
    type: io.kestra.core.tasks.flows.If
    condition: "{{ json(trigger.body).price <= 110 }}"
    then:
      - id: setState
        type: io.kestra.core.tasks.states.Set
        data:
          disabled: true

triggers:
  - id: http
    type: io.kestra.plugin.fs.http.Trigger
    uri: https://fakestoreapi.com/products/1
    responseCondition: "{{ json(response.body).price <= 110 }}"
    interval: PT30S
    - conditions:
      - type: io.kestra.core.models.conditions.types.state.Get
        condition: "{{ disabled != true }}"

from kestra.

anna-geller avatar anna-geller commented on June 12, 2024

alternative option (less favorable but solves the immediate pain): at first, only provide the functionality within this task:

id: http
namespace: dev

tasks:
  - id: slack
    type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
    url: "{{ secret('SLACK_WEBHOOK') }}"
    payload: |
      {
        "channel": "#general",
        "text": "The price is now: {{ json(trigger.body).price }}"
      }

triggers:
  - id: http
    type: io.kestra.plugin.fs.http.Trigger
    uri: https://fakestoreapi.com/products/1
    responseCondition: "{{ json(response.body).price <= 110 }}"
    interval: PT30S
    stopAfterSuccess: true # false by default 

from kestra.

anna-geller avatar anna-geller commented on June 12, 2024

Next steps:

  1. stopAfterSuccess boolean
  2. Update trigger endpoint
  3. UI change with toggle, unlock and Backfill Executions
  4. Reevaluate after user feedback if we need the Toggle task and state store to store previous trigger conditions

from kestra.

anna-geller avatar anna-geller commented on June 12, 2024

to add more info from today's meeting with @brian-mulier-p and @tchiotludo:

  • we added an issue here #2964 for a generic stopAfter success property for all triggers
  • we want to add the Toggle task allowing to disable a specific trigger (as shown below) via an API call (i.e. without changing the source code)
  • we want to support more advanced use cases based on Flow trigger e.g. if a specific critical flow (or if any flow from a "prod" namespace) ends in a FAILED state, send a Slack alert + disable a trigger of that flow
  • for now, automatic reenabling of trigger is out of scope - user needs to reenable the trigger manually once they are ready
      - id: disable_schedule
        type: io.kestra.core.tasks.triggers.Toggle
        namespace: dev
        flowId: http
        triggerId: http
        enabled: false # true to reenable

from kestra.

anna-geller avatar anna-geller commented on June 12, 2024

sounds good!

from kestra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.