Serverless Functions
Scheduled Jobs
How to run workloads on a schedule.
Run Scheduled Jobs
Use the @schedule
decorator to define a scheduled job.
To schedule it, run beam deploy
:
You’ll see the upcoming jobs listed in the console.
Scheduling Options
The following predefined schedules can be used in the when
parameter:
Predefined Schedule | Description | Cron Expression |
---|---|---|
@yearly (or @annually ) | Run once a year at midnight on January 1st | 0 0 1 1 * |
@monthly | Run once a month at midnight on the first day of the month | 0 0 1 * * |
@weekly | Run once a week at midnight on Sunday | 0 0 * * 0 |
@daily (or @midnight ) | Run once a day at midnight | 0 0 * * * |
@hourly | Run once an hour at the beginning of the hour | 0 * * * * |
Stopping Scheduled Jobs
You can stop a scheduled job from running by using the beam deployment stop
CLI command.
First, list the upcoming jobs with beam deployment list
:
Then reference the Deployment ID to stop a job:
Gotchas
If you deploy a new version of your scheduled job, the previous schedule will be disabled.
Was this page helpful?