Schedule a recurring job
Ce contenu n’est pas encore disponible dans votre langue.
Goal
Work that runs on a schedule, with a stated answer for what happens when a firing overlaps or is missed.
Before you start
- An image that runs the work and exits.
- A decision about the time zone. It is stated in the description rather than inherited from whatever the platform process is running in.
- A decision about overlapping firings, and about how late a missed firing may still start.
Steps
- Open Scheduled work and choose New schedule.
- Give it a name, the cron expression and the time zone.
- Fill in the job it runs: image, command, networks, resources and retry limit.
- Choose what an overlapping firing does, and how late a missed firing may start.
- Save, and confirm the next firing time shown is the one you meant.
Steps
- Write a
kind: CronJobdocument with the schedule and a job template. - Apply it. Every field is in the cronjob reference.
Steps
POST /api/v1/cronjobswith the schedule and the job template.GET /api/v1/cronjobs/{name}to see the stored schedule and its state.PUT /api/v1/cronjobs/{name}to change it — including suspending it.
Steps
- There is no CLI command for scheduled work; use the API or the dashboard.
odysseus spec-auditreports on stored specs, which includes schedules.
apiVersion: odysseus/v1kind: CronJobmetadata: name: addriva-etl-ingest labels: {app: addriva-etl-ingest, project: addriva}spec: schedule: "17 1 1 * *" # no timezone: UTC, matching the retired host crontab concurrencyPolicy: skip startingDeadlineSeconds: 300 suspend: false jobTemplate: image: registry.delta-telematics.ca/addriva/etl:0.1.0 placement: {node: vps-71623e00} networks: [addriva-internal] command: ["ingest", "--sources", "oda,geoyukon,adresses_qc", "--version", "ODA_v1_2021"] environment: ADDRIVA_S3_ENDPOINT: "http://addriva-seaweedfs:8333" ADDRIVA_S3_BUCKET: "addriva-raw" ADDRIVA_OS_HOST: "http://addriva-opensearch:9200" ADDRIVA_OS_USER: "admin" secrets: - vaultPath: deployments/addriva-etl rotation: restart resources: limits: {cpu: "2", memory: 3500Mi} requests: {cpu: 500m, memory: 1Gi} restartPolicy: "no" backoffLimit: 2 activeDeadlineSeconds: 14400 ttlAfterFinished: 4392hCronJobManifest · testdata/docs-examples/monthly-cronjob.yamlVerify
The schedule shows its next firing at the time you expect, in the zone you set, and the first run appears in its history.
Evidence this worked
The run history under GET /api/v1/cronjobs/{name} shows run numbers rising on the same job rather
than a new job per firing. That is deliberate: a fresh name per firing would give every run the same
number and scatter the retention limit across unboundedly many names.
When it fails
- The schedule is refused. The grammar, the accepted field values and the deliberate rejections are in the cronjob reference.
- A firing did not happen. It overlapped a run and your policy was to skip it, or it was missed while the platform was down and arrived later than the window you allowed.
- The job template sets identity or status. The schedule owns those; authored values are zeroed rather than rejected.
- Every code: rejections and alterations.