List execution counts for a list of flow.
This can be used to send an alert if a condition is met about execution counts.
yaml
type: "io.kestra.plugin.core.execution.Count"
Send a slack notification if there is no execution for a flow for 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 * * * "
Dynamic
YES
The expression to look at against each flow.
The expression is such that 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
Dynamic
YES
The start date.
Dynamic
YES
The end date.
SubType string
Dynamic
YES
SubType string
Dynamic
YES
Possible Values
CREATED
RUNNING
PAUSED
RESTARTED
KILLING
SUCCESS
WARNING
FAILED
KILLED
CANCELLED
QUEUED
RETRYING
RETRIED
SKIPPED
A list of states to be filtered.
Dynamic
NO
Dynamic
NO
Dynamic
NO
Dynamic
NO
Dynamic
NO