Scheduled runs

DataLab notebooks can be configured to run on a daily or weekly schedule. You can configure a scheduled run by going to 'Run > Schedule run'.

You can now configure the frequency and at what point in time the notebook should run. Additionally, you can specify whether or not you want to be notified by e-mail if the run succeeded and/or failed.

Email notifications are a personal setting per scheduled notebook run. This means that if you are collaborating on a notebook, you and your peer can have different settings for the e-mail notifications for the same notebook schedule.

You can only specify one schedule per notebook; it's not possible to have a notebook run multiple times per day on a schedule.

For long-running notebooks the same limitations apply as dictated in Long-running cells.

Scheduled run variable

The built-in DL_SCHEDULED_RUN environment variable can be used to figure out whether a notebook is being run as part of a scheduled run. You can use this environment variable to decide if you want to do certain things on a schedule but not when run manually or vice versa.

As an example, you may want to post a summary of the analysis in your scheduled notebook to Slack but you don't want to accidentally post anything when you're just working on improving the analysis.

The DL_SCHEDULED_RUN environment variable is set to "TRUE" when the notebook is being run as part of a scheduled run. The environment variable is not set if the notebook is being run manually, not as part of a scheduled run:

# Python
import os

if os.environ.get('DL_SCHEDULED_RUN') == 'TRUE':
  # Your side effect here
# R
if (Sys.getenv("DL_SCHEDULED_RUN") == "TRUE") {
  # Your side effect here
}

Last updated