Skip to content

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.

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 functionCronjob
What runsAn existing edge functionA container built from a repo, or a public image
Runtimefn-invoker microVM (no container)Kubernetes CronJob (a fresh pod per run)
WeightLightHeavy
Run historyThe function’s invocation historyDedicated cronjob execution records
SetupPoint a schedule at a function you already deployedDefine 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.

Scheduled functions use a 5-field cron expression plus a timezone.

PartDetails
cronSchedule5 fields: minute, hour, day-of-month, month, day-of-week. Max 120 chars. Example: */5 * * * * (every 5 minutes).
timezoneIANA 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.

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.
FieldTypeDefaultNotes
namestring1–63 chars, RFC-1123 label (^[a-z0-9]([-a-z0-9]*[a-z0-9])?$).
functionnumber | stringThe target function, by numeric id or by name.
cronSchedulestring5-field cron, 1–120 chars.
timezonestringUTCIANA timezone, 1–64 chars.
enabledbooleantrueEnabling schedules the next run; disabling clears it.
paramsobject{}Params passed to the function on each run.

Each scheduled function tracks its own run state, independent of the underlying function:

FieldMeaning
lastRunAtWhen the schedule last fired.
nextRunAtWhen it will next fire (null when disabled).
lastStatusOutcome of the most recent run.
lastErrorError message from the most recent failed run, if any.
totalRunsTotal number of runs so far.
*/5 * * * * # every 5 minutes
0 * * * * # top of every hour
0 9 * * 1-5 # 09:00 on weekdays

Combine any of these with a timezone (for example America/New_York) to run in local time.