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
14.28k stars 1.22k forks source link

Change the value of the execution's inputs before starting a Replay #2197

Open Ben8t opened 1 year ago

Ben8t commented 1 year ago

Feature description

The use case is rather simple:

Being able to edit input parameters && Replay the tasks "from the middle of flow" would be great for flows featuring long running and/or non-idempotent tasks.

cc @yuri1969

iamviqar commented 1 month ago

@Ben8t I would like to attempt this

MilosPaunovic commented 1 month ago

It's all yours @iamviqar! :rocket:

iamviqar commented 1 month ago

Thanks @MilosPaunovic , do we any sample flow or reproducible steps to get started on this

MilosPaunovic commented 1 month ago

@Ben8t would be the best person to provide the sample flow here.

Ben8t commented 1 month ago

Here is a reproducer:

id: replay_inputs
namespace: company.team

inputs:
  - id: test
    type: STRING
    required: true
tasks:
  - id: log1
    type: io.kestra.plugin.core.log.Log
    message: '{{inputs.test}}'

  - id: if
    type: io.kestra.plugin.core.flow.If
    condition: '{{ inputs.test == "Hello" }}'
    then:
      - id: log2
        type: io.kestra.plugin.core.log.Log
        message: "correct input"

    else:
      - id: error
        type: io.kestra.plugin.core.execution.Fail   

Here we would like to being able to edit input parameters and replay the failing tasks

image

iamviqar commented 1 month ago

Thanks @Ben8t

iamviqar commented 1 month ago

@Ben8t just trying to understand the existing functionality, when failed execution is replayed is it re-initiated from the intermediate failure point or from start ?

Ben8t commented 1 month ago

when failed execution is replayed is it re-initiated from the intermediate failure point or from start ?

Failed execution can be replayed at the task level (where it fails generally) or globally (re-run the full execution). In both cases the users would like be able to change (or not) the flow inputs

iamviqar commented 1 month ago

Quick update, I've started working on this made some changes on UI to incorporate input collection on replay dialogue.

@Ben8t Please confirm if this screen is as expected

image

iamviqar commented 1 month ago

@Ben8t I see restart option on overview screen of execution is also not prompted with input. Do you think this also needs to be fixed?

image

tagging @anna-geller @MilosPaunovic

Ben8t commented 1 month ago

Thanks @iamviqar for the work in progress 👍

Yes, I think it would be a great addition too as it restart the execution from the FAILED task (as highlighted by the tooltip) Screenshot 2024-10-18 at 09 17 00

From the the first screenshot you shared, would it be possible to prefill the input value with the first one filled during the prior execution please ?

I can imagine a flow with many inputs, so as a user I won't be happy to fill everything again if I only need to rerun the execution (without changing any inputs, or only changing one out of of many)

iamviqar commented 1 month ago

Sure @Ben8t , let me attempt to get restart functionality along with this issue and FYI I am already attempting to pre-populate the input values

iamviqar commented 1 month ago

I’ve implemented changes to display the input form in the replay and restart dialogue boxes.

image

image

I updated the UI code to pass the values collected from the input form and created a new API endpoint, /restart-with-input, to avoid altering the existing /replay API. Please let me know if you think it would be better to modify the /replay API instead of creating a new one.

On the API side, I’m successfully receiving the input values from the UI as method parameters. However, I’m having difficulty figuring out how to apply these newly collected inputs to the existing execution, and it's taking me a while to understand the process. I would appreciate some assistance from a backend developer to move forward.

You can refer to this commit for my API code: https://github.com/iamviqar/kestra/commit/a24d3edef7752603a1be05d34dc1d7ae77cfa65e

image

tagging @loicmathieu @tchiotludo @Skraye @MilosPaunovic @anna-geller

MilosPaunovic commented 1 month ago

Hey @iamviqar, is there a PR opened for this, as I can not seem to find it?

anna-geller commented 1 month ago

same suggestion as Milos, perhaps you can share a PR and we can help suggest what's missing to get it to the finish line?

iamviqar commented 1 month ago

Here is the Draft PR: https://github.com/kestra-io/kestra/pull/5698

MilosPaunovic commented 2 weeks ago

@iamviqar What is the status of this PR?

iamviqar commented 2 weeks ago

@MilosPaunovic I need to make progress based on reference code provided by @Skraye on backend implementation.

Ben8t commented 5 days ago

@iamviqar any news on this ?