Skip to content

ADR-0013 — CONDITIONAL_CRON trigger mode

Update date : 2026-05-28 00:00

Status: accepted Date: 2026-05-28

Context

The schedule trigger mode runs on a fixed CRON with a data-driven SKIP (new_files = []). Some pipelines need a time/business-rule driven SKIP independent of data: suspend a client during a billing pause, skip on non-business days, skip during a maintenance window.

Snowflake Tasks do not natively support conditional scheduling beyond CRON and stream triggers.

Decision

Add a 5th trigger mode: CONDITIONAL_CRON.

dag:
  trigger_mode: CONDITIONAL_CRON
  schedule: "0 6 * * *"
  condition: "pinky_core.schedule.is_business_day"

Behaviour: 1. ROOT_TASK_WRAPPER runs on the CRON schedule. 2. It calls the condition function from pinky-core.schedule (pure Python, no Snowflake session needed). 3. If the condition returns FalseROOT_TASK_WRAPPER returns 'SKIP'. 4. Downstream tasks guard on SYSTEM$GET_PREDECESSOR_RETURN_VALUE(...) != 'SKIP' — same mechanism as the existing data-driven SKIP (ADR dag.md).

The condition function is resolved from pinky-core.schedule at deploy time and embedded in the ROOT_TASK_WRAPPER SP body by the provider.

Use cases

Condition Example
Non-business days Skip weekends + public holidays
Client suspension Pause a client's pipeline during a billing lapse
Maintenance window Skip during a declared infra window
Custom predicate Any pure Python bool function in pinky-core.schedule

Consequences

  • Condition logic lives in pinky-core — pure Python, importable anywhere, testable without a Snowflake session or a live task.
  • No new Snowflake infrastructure — reuses the existing SKIP cascade mechanism.
  • The provider embeds the condition at deploy time: changing the condition requires a re-deploy, not a manual task edit.
  • pinky-core.schedule is the single registry for all scheduling predicates — no ad-hoc logic scattered across SP bodies.