Schedule icon
Log icon

Executes flow on schedule trigger with Not condition

Invert schedule conditions in Kestra with a negated `when` expression.

Categories
Core
id: schedule-condition-not
namespace: company.team

triggers:
  - id: schedule
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 11 * * *"
    when: "{{ not (dayOfWeek(trigger.date) == 'MONDAY') }}"

tasks:
  - id: hello
    type: io.kestra.plugin.core.log.Log
    message: Demo for Not condition

Schedule a flow to run daily while excluding specific days, using a when Pebble expression on the Schedule trigger to negate a day-of-week check. This blueprint fires every day at 11am and skips Mondays, giving you a clean, declarative way to build "run on all days except X" calendars without writing extra cron expressions or guard logic inside your tasks.

How it works

  1. A io.kestra.plugin.core.trigger.Schedule trigger uses the cron expression 0 11 * * * to evaluate the flow at 11am every day.
  2. The trigger's when property holds the expression {{ not (dayOfWeek(trigger.date) == 'MONDAY') }}, which negates the day-of-week check.
  3. dayOfWeek(trigger.date) resolves to the day name for the current trigger date, and the comparison against MONDAY is wrapped in not(...).
  4. Because the check is negated, the schedule fires on every day the inner comparison is false. The flow runs Tuesday through Sunday and is skipped on Monday.
  5. When the conditions pass, the hello task (io.kestra.plugin.core.log.Log) writes a confirmation message to the execution logs.

What you get

  • A daily schedule that automatically skips a chosen weekday.
  • A reusable pattern for inverting any when expression, not just day of week.
  • Logs that confirm exactly when the flow ran and when it was skipped.

Who it's for

  • Data engineers who need reports or batches to run on most days but pause on a fixed day.
  • Platform teams encoding business calendars (weekends off, no-deploy days) into orchestration.
  • Anyone replacing brittle "if today is Monday, exit" checks with declarative conditions.

Why orchestrate this with Kestra

Cron alone can express "every day at 11am," but it cannot cleanly express "every day except Monday" without awkward multi-line expressions. Kestra solves this declaratively: the trigger's when property evaluates a Pebble expression on every candidate run, not(...) inverts any boolean check inside it, and the entire schedule is versioned YAML you can review and diff. You also get automatic retries, full execution lineage, and visibility into both runs and skipped evaluations, capabilities a raw scheduler does not provide.

Prerequisites

  • A running Kestra instance.

Secrets

This blueprint references no secrets.

Quick start

  1. Add this flow to your Kestra instance.
  2. Confirm the schedule trigger is enabled.
  3. Watch executions: the flow runs daily at 11am and is skipped each Monday.

How to extend

  • Swap the dayOfWeek(...) check for isWeekend(trigger.date), a specific date comparison, or a time window to exclude other periods.
  • Combine several checks with and/or inside the when expression, then wrap the whole thing in not(...) to invert a combined rule.
  • Replace the Log task with your real workload (ingestion, transformation, notifications).
  • Apply the same negated when expression to a io.kestra.plugin.core.trigger.Flow trigger's dependsOn entry to skip downstream runs on matching days.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.