Scheduled functions
A scheduled function runs an existing edge function automatically on a cron schedule. It is the light-weight scheduling option: instead of spinning up a container, PandaStack invokes your function on the same microVM runtime it uses for on-demand HTTP calls, and each run lands in the function’s normal invocation history.
Scheduled functions vs. cronjobs
Section titled “Scheduled functions vs. cronjobs”PandaStack has two ways to run something on a schedule. Pick based on whether you already have a function or need a full container.
| Scheduled function | Cronjob | |
|---|---|---|
| What runs | An existing edge function | A container built from a repo, or a public image |
| Runtime | fn-invoker microVM (no container) | Kubernetes CronJob (a fresh pod per run) |
| Weight | Light | Heavy |
| Run history | The function’s invocation history | Dedicated cronjob execution records |
| Setup | Point a schedule at a function you already deployed | Define source, language, build/start commands or image |
Use a scheduled function when the work is small and you have already written it as a function. Use a cronjob when you need a full build environment, arbitrary languages, or a public container image.
The schedule
Section titled “The schedule”Scheduled functions use a 5-field cron expression plus a timezone.
| Part | Details |
|---|---|
cronSchedule | 5 fields: minute, hour, day-of-month, month, day-of-week. Max 120 chars. Example: */5 * * * * (every 5 minutes). |
timezone | IANA timezone string; defaults to UTC. Max 64 chars. |
The cron expression is validated by actually parsing it with cron-parser — impossible fields
(for example, minute 99) are rejected at create time with a bad_request error, not silently
accepted.
How execution works
Section titled “How execution works”The scheduler owns execution: it computes the next run, invokes the target function when the tick
arrives, and records the outcome. The API use-cases own CRUD and the next_run_at bookkeeping.
- Enabling a schedule computes and stores the next run time ahead of time.
- Disabling a schedule clears the next run time, so it stops firing.
- Each run is a normal function invocation, so it appears in the function’s invocation history and contributes to its metrics.
Fields
Section titled “Fields”| Field | Type | Default | Notes |
|---|---|---|---|
name | string | — | 1–63 chars, RFC-1123 label (^[a-z0-9]([-a-z0-9]*[a-z0-9])?$). |
function | number | string | — | The target function, by numeric id or by name. |
cronSchedule | string | — | 5-field cron, 1–120 chars. |
timezone | string | UTC | IANA timezone, 1–64 chars. |
enabled | boolean | true | Enabling schedules the next run; disabling clears it. |
params | object | {} | Params passed to the function on each run. |
Run tracking
Section titled “Run tracking”Each scheduled function tracks its own run state, independent of the underlying function:
| Field | Meaning |
|---|---|
lastRunAt | When the schedule last fired. |
nextRunAt | When it will next fire (null when disabled). |
lastStatus | Outcome of the most recent run. |
lastError | Error message from the most recent failed run, if any. |
totalRuns | Total number of runs so far. |
Example schedule
Section titled “Example schedule”*/5 * * * * # every 5 minutes0 * * * * # top of every hour0 9 * * 1-5 # 09:00 on weekdaysCombine any of these with a timezone (for example America/New_York) to run in local time.
Related
Section titled “Related”- Edge functions — deploy the function you want to schedule.
- Cronjobs — the container-based scheduled-job option.
- Functions API reference — scheduled-function endpoints and schemas.