Getting started¶
Install schedr, start it with one DAG, run that DAG, and see it in the web UI.
Install¶
schedr needs Python 3.14 or newer. Install it into a virtual environment in a project
directory of its own; schedr finds that environment by itself later.
mkdir my-schedr && cd my-schedr
python3.14 -m venv .venv
.venv/bin/pip install schedr # add [pydantic] for Pydantic models
With uv the same is uv venv --python 3.14 and
uv pip install schedr.
The package carries the schedr binary, so there is nothing to compile. Wheels exist for
Linux x86_64 (glibc and musl), Linux aarch64 and macOS arm64. Check it:
.venv/bin/schedr --version
Images¶
For Kubernetes or Docker, the images are on ghcr.io, x86_64:
Image |
What it has |
For |
|---|---|---|
|
Python, schedr, the task libraries and connection clients |
standalone, workers, the base for your own image |
|
the same without the task libraries and connection clients |
a smaller base |
|
the binary alone |
the master, the webserver and the UI |
Each is built on Debian (glibc), tagged with the version (1.1.0) and its series (1.1);
the same on Alpine adds -alpine (1.1.0-alpine). There is no latest: a deployment names the
version it runs. Deployment covers the Helm chart.
Run schedr¶
schedr standalone runs everything in one process: the master (the scheduler), the
webserver with the web UI, and one worker that runs the tasks. On a laptop it keeps its state in
SQLite, so there is no database to set up.
A DAG to run¶
In the project directory from Install, make a dags directory with one DAG file
in it, dags/sync.py:
"""The example DAG of archive/PROJECT.md (Native API): extract, load, notify; daily at 03:00."""
from datetime import timedelta
from schedr import CommandOperator, Cron, Dag, StepDefaults, dag_ctx, task
with Dag(
"sync_customers",
description="Syncs customers daily at 03:00 Warsaw time: extract, load, notify.",
trigger=Cron("0 3 * * *", tz="Europe/Warsaw", start="2026-01-01"),
defaults=StepDefaults(retries=2, retry_delay=timedelta(minutes=5)),
):
@task
def extract() -> list[dict[str, str]]:
return [{"id": "1", "name": "Ada"}, {"id": "2", "name": "Grace"}]
@task(timeout=timedelta(minutes=10))
def load(rows: list[dict[str, str]]) -> int:
print(f"loading {len(rows)} customers")
return len(rows)
rows = extract() # Output[list[dict[str, str]]]
count = load(rows) # load depends on extract (data flow)
CommandOperator( # depends on load: its command uses `count`
"notify",
command=["echo", t"synced {count} customers for {dag_ctx.run.planned_for}"],
)
A first DAG explains what each line does.
Start it¶
.venv/bin/schedr standalone --migrate --dag-path dags
--dag-path dagsis the folder schedr watches for DAG files, named after it (dags); repeat it for more. Without it (orSCHEDR_DAG_PATH, the same list from the environment), standalone watches none: it starts with the warning “no DAG directories”, and has nothing to run.--migratecreates the database on the first start, and updates it after an upgrade.Python: tasks and DAG files run with the project’s
.venv, found by itself (an active virtualenv, then.venvorvenvin this directory or a parent, thenpython3beside theschedrbinary or onPATH). The first lines of the log say which one it took.Where things go: the database, the task logs and the journal are in
~/.local/share/schedr($XDG_DATA_HOME/schedrif that is set).Addresses: the API and the web UI on
http://127.0.0.1:8080, from this machine only.
Leave it running and use a second terminal for the rest. A new DAG file shows up within about 35 s: schedr looks for changes every 30 s, and waits for a file to stay unchanged for 5 s.
Note
After a crash (not a Ctrl-C), schedr waits up to about 30 s before it schedules anything: the crashed process’s lease on the database has to run out first. The log says “another master holds the lease; waiting as a standby”, then “leading” when it takes over.
See it¶
Open http://127.0.0.1:8080/ for the web UI: the DAG, its runs and their graphs, task logs.
Or ask from the command line, in the same directory:
.venv/bin/schedr dags list
DAG STATE HELD TRIGGER DEFINED IN
sync_customers paused no 0 3 * * * (Europe/Warsaw), 2025-12-31 .. dags:sync.py
A new DAG starts paused: its trigger creates no runs until you unpause it. Manual runs are still allowed.
Run it¶
Trigger a manual run (a paused DAG can still be run by hand), then look at it:
.venv/bin/schedr runs trigger sync_customers
.venv/bin/schedr runs list sync_customers
.venv/bin/schedr runs show <run-id>
.venv/bin/schedr tasks logs <run-id> notify
After the run finishes, the task table in runs show looks like this:
TASK STATE OUTCOME TRIES INSTANCES REASON
extract success SUCCESS 1
load success SUCCESS 1
notify success SUCCESS 1
To have the scheduler run it at 03:00 Warsaw time every day:
.venv/bin/schedr dags unpause sync_customers
Unpausing creates the latest fire time’s run only, not every day since start: catch-up is
off unless the trigger asks for it (Schedules).
Stop it¶
Ctrl-C stops it: the worker takes no new tasks and gives running ones about 25 s to finish (the details: Workers), then the process gives up its lease on the database and exits, so the next start takes over at once. Starting it again keeps everything: the DAGs, the runs, the logs.
The web UI signs no one in here. That is fine on 127.0.0.1; before you open it to a network,
read Network and security: Sign-in.
Other layouts¶
DAG files in the project folder¶
DAG files can live directly in the project folder. Use --dag-path . and exclude the
virtual environment with .schedrignore (gitignore syntax). Otherwise, schedr copies
.venv with the DAG root and imports Python files in it whose bytes contain schedr.
my-schedr/
├── .schedrignore
├── .venv/
└── sync.py
.venv/
.venv/bin/schedr standalone --migrate --dag-path .
The root takes the folder’s name: schedr dags list shows the definition at
my-schedr:sync.py. Exclude notes, data and test outputs with .schedrignore too. Files
that remain in the scan count toward the code hash, so changing them creates a new code
version.
A plain script¶
To run a script without writing a DAG, declare a job in schedr.toml. Put both files in
a script folder, such as scripts:
my-schedr/
├── .venv/
└── scripts/
├── hello.py
└── schedr.toml
# scripts/hello.py
print("hello from a script")
# scripts/schedr.toml
[jobs.hello]
script = "hello.py"
interpreter = "python"
schedule = "0 6 * * *"
.venv/bin/schedr standalone --migrate --script-path scripts
interpreter = "python" selects the built-in Python interpreter, which finds the project
virtual environment as described above. A scheduled job becomes a one-task DAG and starts
paused. You can run it by hand while paused. Its ID combines the root, declaration file and
job name:
.venv/bin/schedr runs trigger 'scripts:schedr.toml#hello'
.venv/bin/schedr runs list 'scripts:schedr.toml#hello'
.venv/bin/schedr tasks logs <run-id> hello
Use --dag-path and --script-path together to load both kinds of root; repeat either
flag for more folders. Plain scripts lists the job settings,
including arguments, environment variables, secrets, retries and parameters.
Next steps¶
Write DAGs: Writing DAGs, starting with A first DAG: tasks, data between them, schedules, retries.
Test them without a server:
schedr dags checkandschedr dags test, in Testing a DAG, also from pytest.See how it works: How schedr works: the life of a run, the master and workers, failures.
Run it for real: Deployment: standalone in one pod on SQLite, then Postgres, then separate roles, with the Helm chart.
Every setting and command: the configuration and CLI references.