Log icon
Schedule icon
DayWeek icon

Executes flow on schedule trigger with DayWeek condition

Run Kestra flows on specific days of the week using the DayWeek condition. Automate weekday or weekend-restricted workflows with precise scheduling control.

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

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

triggers:
  - id: schedule
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 11 * * *"
    conditions:
      - type: io.kestra.plugin.core.condition.DayWeek
        date: "{{ trigger.date }}"
        dayOfWeek: "MONDAY"

Run a Kestra flow on a recurring cron schedule, then gate each execution so it only proceeds on a specific weekday. This blueprint pairs the io.kestra.plugin.core.trigger.Schedule trigger with the io.kestra.plugin.core.condition.DayWeek condition to fire at 11am every day, while only allowing the run to continue when the trigger date is a Monday. It solves the common scheduling problem where a single cron expression cannot express calendar-aware rules like "run only on Mondays" without brittle workarounds, giving you precise, declarative control over which days a workflow actually executes.

How it works

  1. The schedule trigger of type io.kestra.plugin.core.trigger.Schedule evaluates the cron expression 0 11 * * *, which marks every day at 11am as a candidate execution time.
  2. Before an execution is created, the trigger evaluates its conditions. The io.kestra.plugin.core.condition.DayWeek condition compares {{ trigger.date }} against dayOfWeek: MONDAY.
  3. If the trigger date is a Monday, the execution proceeds. On any other day the condition is not met and no execution is created.
  4. When the run proceeds, the hello task of type io.kestra.plugin.core.log.Log writes a demo message confirming the DayWeek condition matched.

What you get

  • A working pattern for combining a daily cron schedule with a day-of-week gate.
  • Calendar-aware scheduling without custom date parsing or branching logic.
  • A clear, auditable trigger definition expressed entirely in declarative YAML.
  • A starting point you can adapt to any weekday or set of weekdays.

Who it's for

  • Data engineers running pipelines that should fire only on specific weekdays.
  • Platform teams standardizing scheduling patterns across many flows.
  • Anyone who has hit the limits of a plain cron expression for calendar rules.

Why orchestrate this with Kestra

A raw cron scheduler can express "every day at 11am" but cannot cleanly say "only when that day is a Monday" without encoding it into the cron string itself, which quickly becomes unreadable for multi-weekday or exclusion rules. Kestra separates the schedule from the condition, so the cadence and the calendar rule each stay legible. On top of that you get event-driven triggers, automatic retries, full execution lineage, and a declarative YAML definition that lives in version control. The DayWeek condition fills the gap a tool's own scheduler leaves open: readable, composable day-of-week logic layered on a standard cron schedule.

Prerequisites

  • A running Kestra instance.

Secrets

This blueprint references no secrets.

Quick start

  1. Add this flow to your Kestra instance.
  2. Leave it enabled so the schedule trigger evaluates daily at 11am.
  3. On the next Monday at 11am, confirm an execution is created and the hello task logs its message.
  4. Verify that no execution is created on other days.

How to extend

  • Change dayOfWeek to any weekday, for example FRIDAY, to shift the allowed day.
  • Add multiple DayWeek conditions or combine with other conditions to allow a set of weekdays.
  • Adjust the cron expression to change the time of day or frequency.
  • Replace the hello Log task with real work such as a data load, API call, or notification.

Links

Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.