Beam apps can be run on a schedule with the schedule decorator.

from beam import App, Volume, Output

app = App(
        Volume(name="files", path="./files"),

@app.schedule(when="every 5m")
def handler():

schedule supports cron and string expressions. You can use Crontab to help generate expressions.

Scheduled Jobs are run based on the UTC timezone.
whenYesThe scheduling time or interval for the task execution. It can be a cron or string expressions. You can use Crontab to help generate expressions.
runtimeNoThe runtime environment to execute the scheduled task. Default is None.
outputsNoA list of outputs for handling the results of the scheduled task. Default is [].
callback_urlNoA URL where task execution status updates will be sent. If provided, the system will make a single POST request to this URL with status updates for each task. Default is None.

Testing your function

You can create a one-off run of your function with beam run:

beam run

You can also pass in JSON payloads by using the -d flag:

beam run -d '{"your_key": "your_value"}'

Deploying a Scheduled Job

To deploy the app, enter your shell and run this command from the working directory:

beam deploy

After running this command, you’ll see some logs in the console that show the progress of your deployment.

Cron Expression Cheatsheet

Beam supports standard cron expressions. Here are a few examples:

Every minute*/1 * * * *
Every day at mightnight0 0 * * *
10:15am, daily0 15 10 ? * *
2:10 p.m. and at 2:44 p.m. every Wednesday in the month of March0 10,44 14 ? 3 WED

String Expression Cheatsheet

You can also write expressions using a friendlier human-readable syntax, for intervals up to 1 hour.

Every 1 secondevery 1s
Every 5 minutesevery 5m
Every 1 hourevery 1h

Further Reading