Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a runnable task WaitFor that will run a task until a specific condition is true #3587

Closed
anna-geller opened this issue Apr 19, 2024 · 0 comments · Fixed by #3652
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@anna-geller
Copy link
Member

anna-geller commented Apr 19, 2024

Feature description

Syntax:

id: check_for_job_status
namespace: dev

tasks:
  - id: databricks_job
    type: io.kestra.core.tasks.flows.WaitFor
    condition: "{{ (outputs.poll.body | jq('.state.result_state') | first) == 'SUCCESS' }}"
    task:
      id: poll
      type: io.kestra.plugin.fs.http.Request
      uri: https://reqres.in/api/job-status
      method: GET
      contentType: application/json
    checkFrequency:
      interval: PT1S # type: Duration
      maxDuration: PT1H # type: Duration
      maxAttempts: 50 # type: int

Icon:
image (1)

The reason for this task (and the implementation):

  1. Implementing a WhileLoop that would satisfy multiple use cases in one go proved challenging as we cannot promise this level of statefulness
  2. Implementing a flowable task that could execute multiple tasks within the loop could break the executor
  3. We don't implement all the same functionality as we do on the retry in the checkFrequency because this task is meant for waiting until the condition is satisfied (blocking calls) rather than for fetching data from APIs, which might require exponential retries.

For those reasons, we decided to implement this as a runnable task that can execute a single task. Later, we may explore the WhileLoop once we figure out a solution to the second issue as part of the ForEachItem redesign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants