Skip to content

Commit

Permalink
feat: blueprint for runIf task attribute (#17)
Browse files Browse the repository at this point in the history
* feat: blueprint for runIf task attribute

* Update runif-task-attribute.yaml

---------

Co-authored-by: Will Russell <[email protected]>
  • Loading branch information
shrutimantri and wrussell1999 authored Dec 11, 2024
1 parent e066167 commit 9560ccd
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions runif-task-attribute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
id: runif-task-attribute
namespace: company.team

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

tasks:
- id: step1
type: io.kestra.plugin.core.log.Log
message: "This will always run"

- id: step2
type: io.kestra.plugin.core.log.Log
runIf: "{{ inputs.run_everything }}"
message: "This will only run if set to true"

triggers:
- id: schedule
type: io.kestra.plugin.core.trigger.Schedule
cron: 0 10 * * *
inputs:
run_everything: true

extend:
title: Run the task based on runIf condition
description: >-
This workflow will only run `step2` if the input `run_everything`
is set to `true`. This allows you to build a workflow where you
can decide to run all of it or specific parts based on inputs.
Using `runIf` task attribute is recommended over the
[If](https://kestra.io/plugins/core/tasks/flow/io.kestra.plugin.core.flow.if)
task when you have only have one task that needs to be run based on this condition.
The workflow also uses a schedule that sets the input to `true`. This is a good
way to have the schedule run different parts of the workflow, or have
a debug mode that you only use when executing the flow manually.
tags:
- If
- Schedule
- Trigger
ee: false
demo: true
meta_description: This workflow demonstrates using the runIf task attribute.

0 comments on commit 9560ccd

Please sign in to comment.