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 TerminateSuccessfully task to immediately end the execution in a Success state without processing any downstream tasks #5599

Open
anna-geller opened this issue Oct 22, 2024 · 9 comments
Labels
area/backend Needs backend code changes enhancement New feature or request kind/quick-win Seems to be quick to do

Comments

@anna-geller
Copy link
Member

anna-geller commented Oct 22, 2024

id: myflow
namespace: company.team
tasks:
  - id: success
    type: io.kestra.plugin.core.execution.TerminateSuccessfully

The main goal of this task would be to introduce a behavior similar to Python's sys.exit(0) or linux exit 0.

@anna-geller anna-geller added area/backend Needs backend code changes enhancement New feature or request kind/quick-win Seems to be quick to do labels Oct 22, 2024
@Smiloutcha
Copy link

Hi @anna-geller, could you clarify the purpose of adding this feature? Will it provide a specific functionality, or is it intended just for demonstration purposes?

@anna-geller
Copy link
Member Author

One user asked about it for a more elaborate conditional logic so we opened the issue

In case you consider contributing, keep in mind this will need to touch some code on the Executor side to be aware of this new task that can set Execution state to a Success

@Smiloutcha
Copy link

Hello @anna-geller,
I’d love to contribute! However, I’m still unclear on the specifics behind the Success type. When the workflow reaches a task of type Success, what exactly should I be checking? Additionally, could you provide the steps for debugging Kestra from the Docker image? I’ve tried but haven’t been successful so far.

@MilosPaunovic
Copy link
Member

Hi @Smiloutcha,

It might be better if you'd look through other issues from the curated list of good first ones and check if there is any which you can solve independently. That way, your help would be most aprreciated. 🚀

@Smiloutcha
Copy link

Hello @MilosPaunovic,
Thank you for your response. Could you help me understand the reason behind your suggestion? I’d appreciate any clarification.

@anna-geller anna-geller changed the title Add Succeed task Add TerminateSuccessfully task to immediately end the execution in a Success state without processing any downstream tasks Oct 23, 2024
@anna-geller
Copy link
Member Author

anna-geller commented Oct 23, 2024

@Smiloutcha I refined the issue body and I'm adding an example below that shows the use case for this new plugin: task3 and task4 should never run if the input is set to false

id: conditional
namespace: company.team

inputs:
  - id: run_if_true
    type: BOOLEAN
    defaults: true

tasks:
  - id: conditional
    type: io.kestra.plugin.core.flow.If
    condition: "{{ inputs.run_if_true }}"
    then:
      - id: task1
        type: io.kestra.plugin.core.log.Log
        message: Hello 
      - id: task2
        type: io.kestra.plugin.core.log.Log
        message: Hello     
    else:
      - id: exit_0
        type: io.kestra.plugin.core.execution.TerminateSuccessfully

  - id: task3
    type: io.kestra.plugin.core.log.Log
    message: This should not run if  "{{ inputs.run_if_true }}" is false
    
  - id: task4
    type: io.kestra.plugin.core.log.Log
    message: This should not run if  "{{ inputs.run_if_true }}" is false   

@Smiloutcha
Copy link

@anna-geller Thank you! This explanation makes things much clearer. I just need some help with the configuration, as I’m still unable to debug on Kestra. If possible, I’d love to get started on the issue.

@anna-geller
Copy link
Member Author

the contributor instructions on how to build kestra locally are here https://kestra.io/docs/getting-started/contributing#build-kestra-locally

@Smiloutcha
Copy link

@anna-geller Thank you! I’ll work on the configuration and get started on it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Needs backend code changes enhancement New feature or request kind/quick-win Seems to be quick to do
Projects
Status: Backlog
Development

No branches or pull requests

3 participants