List execution counts for a list of flows.
This can be used to send an alert if a condition is met about execution counts.
yaml
type: "io.kestra.plugin.core.execution.Count"Examples
Send a slack notification if there is no execution for a flow in the last 24 hours.
yaml
id: executions_count
namespace: company.team
tasks:
- id: counts
type: io.kestra.plugin.core.execution.Count
expression: "{{ count == 0 }}"
flows:
- namespace: company.team
flowId: logs
startDate: "{{ now() | dateAdd(-1, 'DAYS') }}"
- id: for_each
type: io.kestra.plugin.core.flow.ForEach
concurrencyLimit: 0
values: "{{ jq outputs.counts.results '. | select(. != null) | .[]' }}"
tasks:
- id: slack_incoming_webhook
type: io.kestra.plugin.notifications.slack.SlackIncomingWebhook
payload: |
{
"channel": "#run-channel",
"text": ":warning: Flow `{{ jq taskrun.value '.namespace' true }}`.`{{ jq taskrun.value '.flowId' true }}` has no execution for last 24h!"
}
url: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
triggers:
- id: schedule
type: io.kestra.plugin.core.trigger.Schedule
backfill: {}
cron: "0 4 * * * "
Properties
expression *Requiredstring
The expression to check against each flow
The expression is such that the expression must return true in order to keep the current line.
Some examples:
yaml {{ eq count 0 }}: no execution foundyaml {{ gte count 5 }}: more than 5 executions
startDate *Requiredstring
The start date
endDate string
The end date
flows Non-dynamicarray
namespaces array
SubType string
states array
SubType string
Possible Values
CREATEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTA list of states to be filtered