Recurring Executions

A ScheduledExecution creates Executions on a recurring schedule, similar to Kubernetes CronJobs or Argo’s CronWorkflows. Use them for recurring workflows like nightly test deployments, periodic cleanup jobs, or scheduled data processing.

Each time the schedule triggers, kontinue creates a new Execution with the configured function and arguments. The ScheduledExecution tracks active executions and maintains a history of past runs.

Configuration

Create a ScheduledExecution with a cron schedule:

apiVersion: kontinue.cloud/v1alpha1
kind: ScheduledExecution
metadata:
  name: nightly-tests
spec:
  schedule: "0 2 * * *"           # Run at 2am daily
  function: run-integration-tests
  arguments:
    environment: staging
    suite: full
  historyLimit: 10                # Keep last 10 executions
  executionDefaults:              # Defaults for spawned executions
    retry:
      retries: 2
      backoff: 30s
    ttl:
      deleteAfter: 24h

FieldDescriptionDefault
scheduleCron expression (standard 5-field format)Required
functionName of the function to executeRequired
argumentsInput arguments passed to the function{}
historyLimitNumber of past Executions to retain5
suspendIf true, no new Executions are createdfalse
executionDefaultsDefault retry, timeout, and TTL for spawned ExecutionsNone

Schedule Format

The schedule uses standard cron format with 5 fields:

┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *

Common examples:

ScheduleDescription
*/5 * * * *Every 5 minutes
0 * * * *Every hour on the hour
0 2 * * *Daily at 2:00 AM
0 0 * * 0Weekly on Sunday at midnight
0 0 1 * *Monthly on the 1st at midnight
0 9 * * 1-5Weekdays at 9:00 AM

Execution Defaults

Configure defaults for all Executions created by the schedule:

spec:
  schedule: "0 * * * *"
  function: hourly-sync
  executionDefaults:
    retry:
      retries: 3
      backoff: 1m
      childPolicy: RetryFailed
    timeout:
      attempt: 30m
      overall: 2h
    ttl:
      deleteAfter: 48h

These defaults apply to every Execution created by this schedule. See Automatic Retries and Timeouts for details.

Suspending a Schedule

Temporarily pause a schedule without deleting it:

spec:
  schedule: "0 * * * *"
  function: my-function
  suspend: true

While suspended, no new Executions are created. Existing active Executions continue running. Resume by setting suspend: false or removing the field.

kontinue schedule suspend nightly-tests

# Suspend via kubectl patch
kubectl patch scheduledexecution nightly-tests -p '{"spec":{"suspend":true}}'

# Resume
kontinue schedule resume nightly-tests

kubectl patch scheduledexecution nightly-tests -p '{"spec":{"suspend":false}}'

History Retention

The historyLimit controls how many past Executions are retained. When a new Execution is created and the limit is exceeded, the oldest completed Executions are deleted.

spec:
  schedule: "*/5 * * * *"
  function: health-check
  historyLimit: 3  # Only keep last 3 executions

Set to 0 to delete Executions immediately after completion (not recommended for debugging). Active (non-terminal) Executions are never deleted by history cleanup.

Monitoring Schedules

List all scheduled executions:

kontinue schedules list
# or
kubectl get scheduledexecutions

Example output:

NAME            FUNCTION    SCHEDULE      SUSPEND  LAST SCHEDULE  NEXT SCHEDULE  ACTIVE
nightly-tests   run-tests   0 2 * * *     false    8h             16h            0
hourly-sync     sync-data   0 * * * *     false    45m            15m            1
paused-job      cleanup     0 0 * * *     true     2d             <none>         0

View schedule details:

kubectl describe scheduledexecution nightly-tests

The status shows:

  • lastScheduleTime: When the last Execution was created
  • nextScheduleTime: When the next Execution will be created
  • lastExecutionName: Name of the most recent Execution
  • activeExecutions: List of currently running Executions