kestra-io / kestra

Infinitely scalable, event-driven, language-agnostic orchestration and scheduling platform to manage millions of workflows declaratively in code.
https://kestra.io
Apache License 2.0
7.67k stars 470 forks source link

Add a Wait task (or Sleep/Delay task) #4879

Open anna-geller opened 1 week ago

anna-geller commented 1 week ago

Feature description

Often, even for testing/demo, we need to make execution run for at least X number of seconds/minutes. Atm, we tend to run it in a container or local process, which can be costly + too many lines of code:

id: sleep
namespace: company.team
tasks:
  - id: wait
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.plugin.core.runner.Process
    commands:
      - sleep 10

It would be useful to add a dedicated tasks for it:

id: sleep
namespace: company.team
tasks:
  - id: wait
    type: io.kestra.plugin.core.flow.Wait
    duration: PT30S

Seems useful for unit testing too.

loicmathieu commented 1 week ago

Pause is already there for that, moreover pause can be resumed, and free the worker thread for other tasks.

anna-geller commented 1 week ago

Yes correct, I'm aware. Pause has to be Resumed (unless you dive deeper to understand how timeout + delay works) -- we need a simple Wait task that will keep the Execution in a RUNNING state -- often needed for process orchestration too

loicmathieu commented 1 week ago

No, pause can be resume, by default a Pause with a delay do exactly the same as what you propose here except that it frees the worker thread (and allow resuming if for some reason you don't want to wait for so long).