Skip to main content
On this page

Admin

Scheduled jobs

Run schema syncs and tests on a schedule, with jobs in kater.config.yaml and one system cron line.

Audience
Platform admins
Prerequisites
  • A server account that runs Kater over the content root
  • A warehouse credential that signs in without a browser

Scheduled jobs keep your datasets in step with the warehouse and run your tests after every sync, so restated data shows up as a failing test before anyone reads a wrong number. You declare jobs in kater.config.yaml at the content root. System cron runs them through one kater job tick line.

Declare jobs

This is ShopTech’s file. It syncs the Snowflake connection at 02:00 UTC, then runs every test right after the sync succeeds.

kater.config.yaml
jobs:
sync_snowflake:
command: kater sync
connection: snowflake_prod_connection
deployment: production
schedule:
enabled: false
cron: "0 2 * * *" # Example: daily at 02:00 UTC. Choose a time after warehouse loads.
timezone: UTC
# Runs every test of the connection right after sync_snowflake succeeds, so data
# restated upstream shows as failing tests in the header bell. No schedule of its own.
test_snowflake:
command: kater test
connection: snowflake_prod_connection
deployment: production
after: sync_snowflake

Turn the schedule on

A schedule is off until enabled is true.

KeyWhat it doesExample
commandkater sync syncs the connection’s datasets. kater test runs every test of the connection’s shared layer and connection workspaces.kater sync
connectionThe connection the job runs onsnowflake_prod_connection
deploymentThe deployment that runs it. A runner runs only its own deployment’s jobs. The default is production.production
schedule.cronWhen it runs, as a five-field cron expression"0 2 * * *"
schedule.timezoneAlways UTCUTC
schedule.enabledWhether the schedule runs. The default is false.true
afterRun right after this job succeedssync_snowflake
  • One trigger. Give a job a schedule or an after, not both.
  • One job per command. Define one job per command, connection and deployment.
  • Chains end in a schedule. A job runs after a job of its own deployment and connection. A loop of after jobs is refused.
  • Plain cron. Use five fields with no H or R.
  • No browser sign-in. A job fails when its warehouse credential needs a person to sign in. Use a key pair or a password.
  • Test results reach the bell. A failing test run shows in the header bell. A passing run clears it.

Run jobs with cron

  1. Print the cron line.

    In the content root on the server, run kater job crontab --kater-root . --deployment production. It prints the line and never installs it.

  2. Install it.

    Add the line to the crontab of the account that runs Kater. It calls kater job tick once a minute, which runs the jobs due that minute and any still queued.

  3. Add secrets, if you need to.

    Pass --env-file with a dotenv file the deployment owns. Variables already in the environment win.

crontab
# Kater deployment jobs: UTC schedules are evaluated by the runner.
# Requires a configured trusted administrator identity in the runner environment.
* * * * * cd /srv/kater-content && /srv/kater/.venv/bin/python -m kater_cli job tick --kater-root /srv/kater-content --deployment production --json

The paths in your line are your own.

Check and run by hand

CommandWhat it does
kater job list --kater-root . --deployment productionList the deployment’s jobs, next runs and last runs.
kater job run sync_snowflake --kater-root . --deployment productionRun one job now, then the jobs set to follow it.
kater job history --kater-root . --deployment productionList earlier job runs, newest first. Add --job or --limit.
kater logs job 0f3c9a6e2b8d4f17a5c1e9b04d72a6c3 --kater-root . --deployment productionShow one job run’s result.

Run these in the content root on the server. Every kater job command needs --kater-root, and does not use a saved scope. Agents and the Files terminal refuse the job group.

Check it worked

  • kater job list shows a next run for each enabled job.
  • kater job history shows a run after the scheduled minute.
  • kater sync status shows when each dataset sync last succeeded.

Result cache settings

kater.config.yaml also holds cache, which sets how long Kater uses and keeps query results. See cache.

Next steps