Skip to content

ScheduledJob

Persistent scheduled job configuration.

Stores cron job definitions that are loaded by the worker
process at startup, enabling dynamic job scheduling.
Attributes:
name: Unique job identifier
function: Dotted path to job function (e.g., 'myapp.jobs.send_email')
cron_expression: Cron syntax string (e.g., '0 9 * * *')
enabled: Whether the job is active
last_run: Timestamp of last execution (updated by worker)
next_run: Timestamp of next scheduled run (calculated)

Source: scheduled_job.py

Field Type Required Description Validators
name str Unique job identifier minLen: 1, maxLen: 255
function str Dotted path to job function (e.g., ‘myapp.jobs.send_email’) minLen: 1
cron_expression str Cron syntax (e.g., ‘0 9 * * *’ for daily at 9 AM) minLen: 1
enabled bool Whether the job is active and should be scheduled -
last_run None Timestamp of last execution (set by worker) -
next_run None Timestamp of next scheduled run (calculated) -
Role Create Delete Read Write
Admin
Employee
Manager
Setting Value
Submittable False
Track Changes True

Controller hooks are implemented in *_controller.py files. Available lifecycle hooks:

  • validate() - Called before save, raise exceptions for validation errors
  • before_insert() - Called before inserting a new document
  • after_insert() - Called after successfully inserting
  • before_save() - Called before saving (insert or update)
  • after_save() - Called after saving
  • before_delete() - Called before deleting
  • after_delete() - Called after deleting