---
title: Triggers and scheduling
description: Schedule jobs on the dltHub platform with cron, intervals, follow-up chains, freshness constraints, and refresh cascades
keywords: [dlthub platform, triggers, scheduling, cron, interval, backfill, follow-up, freshness, refresh, tags]
---
# Triggers and scheduling

A **trigger** declares when a job runs. Triggers are attached to a decorated job via the `trigger=` argument and are the source of truth for scheduling on the dltHub platform — there is no separate CLI for adding or removing schedules. Change the decorator, redeploy.

```py
from dlt.hub import run
from dlt.hub.run import trigger

@run.pipeline("github_pipeline", trigger=trigger.every("5m"))
def load_commits():
    ...
```

This page covers all the trigger types and the related scheduling features.

## Basic triggers

| Trigger                                | Meaning                                                                                                              |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `trigger.every("5m")`                  | Recurring interval (`"5m"`, `"6h"`, seconds as float)                                                                |
| `trigger.schedule("0 * * * *")`        | Cron expression                                                                                                      |
| `trigger.once("2026-12-31T23:59:59Z")` | One-shot at a timestamp                                                                                              |
| `"*/5 * * * *"`                        | Bare cron string — auto-detected                                                                                     |
| `upstream_job.success`                 | Follow-up — fires when an upstream job completes successfully                                                        |
| `upstream_job.fail`                    | Follow-up — fires when an upstream job fails                                                                         |
| `upstream_job.completed`               | Follow-up — fires on success or failure                                                                              |
| `"job.fail:tag:ingest"`                | Follow-up on every job matching a selector, used by [agent jobs](../agents/agent-definitions.md#triggers-for-agents) |
| no `trigger=` at all                   | The job runs only when started by hand, and its runs carry a `manual:` trigger                                       |

A selector after `job.fail:` or `job.success:` takes the same forms `dlthub job trigger` takes: `tag:<tag>`, `batch:`, `*`, or a job ref. A job ref names one job: `jobs.<section>.<job>`, where the section is the module the job is declared in or the `section=` argument on its decorator. So `job.success:jobs.github_pipeline.load_commits` fires when the `load_commits` job in `github_pipeline.py` succeeds, and `job.fail:jobs.github_pipeline.*` fires on a failure of any job in that module. `dlthub job list` prints the job refs of a deployment. See [Job configuration via TOML](job-configuration.md#job-configuration-via-toml).

The runner adds the `manual:` trigger itself, so passing `trigger.manual()` raises `InvalidTrigger: manual: triggers are added automatically`. Set `expose={"manual": False}` to keep the runner from adding it.

## Multiple triggers

A job can have any number of triggers. Pass a list and inspect `run_context["trigger"]` to discover which one fired:

```py notype
from dlt.hub.run import TJobRunContext

@run.job(
    trigger=[
        trigger.schedule("0 * * * *"),
        upstream_ingest.success,
    ],
)
def transform(run_context: TJobRunContext):
    if run_context["trigger"] == "schedule":
        ...
    elif run_context["trigger"] == "followup":
        ...
```

`TJobRunContext` is a dict injected by the launcher with: `run_id`, `trigger`, `refresh`, the `profile` that the job runs with, and the scheduler-supplied `interval_start` / `interval_end` (see [Scheduler-driven intervals](#scheduler-driven-intervals) below).

A list of triggers means "any of these": the job runs whenever one of them fires, and each one starts its own run. With `trigger=[job_a.success, job_b.success, job_c.success]`, the job runs once after each upstream job succeeds, so up to three times.

### Wait for several upstream jobs

To run a job once, after all of its upstream jobs have finished, combine a [follow-up trigger](#follow-up-triggers) and a [freshness check](#freshness-checks) for each upstream job:

```py notype
@run.job(
    trigger=[job_a.success, job_b.success, job_c.success],
    freshness=[job_a.is_fresh, job_b.is_fresh, job_c.is_fresh],
)
def job_d(run_context: TJobRunContext):
    ...
```

Each upstream success tries to start `job_d`, but the freshness check skips the run while any upstream job's latest run is still running or failed. `job_d` runs once, right after the last upstream job finishes.

To run the job at a fixed time instead, keep the freshness check and give it a schedule:

```py notype
@run.job(
    trigger=trigger.schedule("0 8 * * *"),
    freshness=[job_a.is_fresh, job_b.is_fresh, job_c.is_fresh],
)
def job_d(run_context: TJobRunContext):
    ...
```

At each scheduled time, `job_d` runs only if the latest run of every upstream job completed. Otherwise that run is skipped, and `job_d` tries again at its next scheduled time.

## Follow-up triggers

Every decorated job exposes `.success`, `.fail`, and `.completed` trigger properties. Use them to chain jobs into a dependency graph.

```py notype
from dlt.hub.run import TJobRunContext

@run.pipeline("transform_pipeline", trigger=ingest_job.success)
def transform(run_context: TJobRunContext):
    ...
```

Follow-up triggers fire as soon as the upstream completes, with no polling and no scheduler delay. When retries are configured, on-failure triggers won't fire any follow-up until the final attempt and only if it is also a failure.

## Scheduler-driven intervals

For incremental pipelines, declare the overall time range with `interval=` and let the dltHub platform hand each run a `[interval_start, interval_end]` window:

```py notype
@run.pipeline(
    my_pipeline,
    interval={"start": "2026-01-01T00:00:00Z"},
    trigger=trigger.schedule("*/3 * * * *"),
)
def daily_ingest(run_context: TJobRunContext):
    start = run_context["interval_start"]
    end = run_context["interval_end"]
    # pass start/end into your source so it is a pure function of inputs
    ...
```

Behaviour:

- Each run gets the interval that just elapsed
- Missed runs are backfilled automatically — windows extend back continuously
- On refresh, the dltHub platform resets the interval pointer to `interval.start`
- Source code stays stateless — no cursor persistence, no state lookups

### Schedule/cron and every intervals

A `schedule` trigger is defined with a cron expression and produces intervals that start and end at absolute points in time — the cron ticks. The scheduler starts a job when an interval **closes**, handing it the window that just elapsed. Take a daily schedule firing at 3am, `trigger.schedule("0 3 * * *")`: the run started on May 26th at 3:00 receives the interval from May 25th 3:00 to May 26th 3:00. The same rule applies to a newly deployed job — it does not run on deployment but starts for the first time when the current interval elapses: deploy the 3am job at noon on May 25th and the first run happens on May 26th at 3:00, covering the May 25th–26th window.

When such a job is started manually (e.g., `dlthub job trigger` or `dlthub run`), it receives the *current* interval: from the end of the last completed interval up to the most recent elapsed cron tick. In most cases these coincide — the scheduled run already covered everything up to the last tick, and the window currently in progress belongs to the next tick — so the interval is **empty** (`interval_start == interval_end`). An empty interval means there is no new window to process, and incremental jobs should treat it as a no-op. The exception is a missed or failed scheduled tick: a manual run then backfills the uncovered gap. To force already-loaded windows to be reprocessed, use a [refresh](#refresh-cascade) instead.

An `every` trigger generates relative intervals of a fixed period, starting from now rather than at absolute tick times. A newly deployed job runs for the first time once the period has elapsed: deploy `trigger.every("1h")` at 14:20 and the first run starts at 15:20 with the interval 14:20 to 15:20. When run manually, the interval spans from the previous run start to now — so unlike cron jobs, manual runs of `every` jobs always receive a non-empty interval.

## Freshness checks

`freshness=[upstream.is_fresh]` blocks a job until the upstream's most recent interval has fully completed:

```py notype
@run.pipeline(
    "report_pipeline",
    trigger=trigger.schedule("0 * * * *"),
    freshness=[ingest_job.is_fresh],
)
def build_report(run_context: TJobRunContext):
    ...
```

Unlike a trigger, the job still runs on its own schedule — it just skips while upstream is mid-load. Use for transforms that must not observe partial data.

The upstream job is fresh when its latest run completed and covered the last interval that its schedule closed. A run that is still in progress or that failed makes it stale.

- **A tick while upstream is stale is skipped.** The scheduler records no run for it and tries again later.
- **When the upstream run completes, the scheduler starts the downstream job at once**, without waiting for its next tick. It starts the job only when the job is ready: it is not paused, all its freshness checks pass, and it has an interval that it did not process yet.
- **The downstream job catches up in one run.** After skipped ticks, its next run gets one interval that covers the whole range it missed.
- **A failed upstream run blocks the chain.** Fix the upstream job: its next run gets the failed interval again, and the downstream jobs follow by themselves.

[Run transformations in jobs](../transformations/run-in-jobs.md) shows an ingestion job and two transformation jobs that are connected this way.

:::note
Invalidation and replacement of a single interval is not yet supported. Once done you'll be able to do:

* **Parallel backfills** — splitting a historical range into many intervals processed concurrently.
* **Partial refresh** — invalidating specific intervals so only the affected windows are reloaded.
* **Interval-based freshness** — today freshness is a single watermark: a downstream job is gated only on the upstream's most recent completed interval. With interval-based freshness, every upstream interval that arrives (including late or replayed ones) would mark the matching downstream window stale, so the downstream job is re-run exactly for the affected windows instead of relying on a full refresh cascade.
:::

## Refresh cascade

A backfill job with `refresh_propagation="always"` originates a refresh signal that propagates through all downstream jobs in the dependency graph. Downstream jobs receive `run_context["refresh"] = True` and react accordingly (for example `pipeline.refresh = "drop_sources"`).

Refresh policies:

| Policy     | Behaviour                                                                     |
| ---------- | ----------------------------------------------------------------------------- |
| `"always"` | Originate a refresh signal on every run                                       |
| `"auto"`   | Pass through any refresh signal received from upstream (default)              |
| `"block"`  | Stop refresh propagation here; an explicit `--refresh` of this job is ignored |

```py
from dlt.hub import run

@run.job(expose={"tags": ["backfill"]}, refresh_propagation="always")
def backfill():
    """Cascade a refresh; does not load data."""
```

Then trigger it from the CLI:

```cli
dlthub job trigger "tag:backfill"
dlthub run backfill --refresh    # explicit refresh on a single job
```

The cascade follows [freshness checks](#freshness-checks). A refresh of a job resets the progress of that job and of every job that declares freshness on it, directly or through other jobs. The refreshed job gets one run from its `interval.start`. When that run completes, the scheduler starts each downstream job with `run_context["refresh"] = True` and its own interval from `interval.start`. A job that only follows with a [follow-up trigger](#follow-up-triggers) is started without the refresh signal.

Note that the refresh signal will not drop your data automatically, you should use one of the [refresh](../../general-usage/pipeline.md#refresh-pipeline-data-and-state) options available. To apply one to every pipeline that a job runs, set `auto_refresh_pipeline_mode` for all jobs in `.dlt/config.toml`, or pass it to the job decorator:

```toml
[jobs]
auto_refresh_pipeline_mode = "drop_sources"
```

The mode applies only in runs that carry the refresh signal. An explicit `refresh=` argument on `dlt.pipeline()` wins over it. To set the refresh mode in the job code instead, read the signal from the run context:

```py notype
@run.pipeline(
    "report_pipeline",
    trigger=trigger.schedule("0 * * * *"),
    freshness=[ingest_job.is_fresh],
)
def build_report(run_context: TJobRunContext):
    ...
    report_pipeline.run(
        data_source(),
        refresh="drop_data" if run_context["refresh"] else None
    )
```

Above we tell `dlt` to truncate all tables belonging to resources in `data_source()` if the refresh signal got passed in the `refresh` flag.

## Tags and bulk triggering

Tags are labels on jobs (set via `expose={"tags": [...]}`). A tag that starts with `__` is reserved by dltHub and never acts as a trigger. See [Retries](job-configuration.md#retries). Tags are used to:

1. Group related jobs in the dashboard
2. Run bulk operations from the CLI via **selectors**

```cli
# trigger every job tagged "ingest"
dlthub job trigger "tag:ingest"

# trigger every job that has a schedule
dlthub job trigger "schedule:*"

# preview without running
dlthub job trigger "tag:ingest" --dry-run
```

## Timezone

Cron expressions default to UTC. To interpret them in a specific IANA timezone, declare it on the job:

```py notype
@run.pipeline(
    my_pipeline,
    trigger=trigger.schedule("0 9 * * *"),    # 9am
    require={"timezone": "Europe/Berlin"},    # ...in Berlin time
)
def morning_load():
    ...
```

Intervals in `run_context` remain UTC datetimes, but they align to tick boundaries in the declared timezone.

`require={"timezone": ...}` holds for the whole run, whether or not the trigger generates an
interval. This timezone is also the [context timezone](../../general-usage/schema.md#context-timezone)
for the run, so `dlt` reads a naive timestamp in it and takes the day of a `date` column in it.
When a job declares no timezone, `dlt` uses UTC.

## Next steps

- [Job configuration](job-configuration.md) — execution timeouts, dependency groups, TOML config sections
- [Deployments](deployments.md) — `dlthub deploy` and the deployment manifest
- [Monitoring and debugging](monitoring.md) — watch what triggers fire and diagnose failures
