DataLab Docs
  • What is DataLab?
  • Work
    • Creating a workbook
    • Sharing a workbook
    • Managing a workbook
    • Code cell
      • Working with packages
    • Text cell
      • Including images
    • SQL cell
      • SQL scenarios
      • Parameterize your SQL query
    • Explore Data cell
    • Chart cell
      • Configuring your chart
      • Pivot charts
      • Migration guide
    • AI Assistant
    • Version history
    • Scheduled runs
    • Hiding and showing cells
    • Long-running cells
    • Report view
    • Environment variables
    • Git and GitHub
  • Connect to Data
    • Connect your data to DataLab
    • Sharing a Data Source
    • Airtable
    • Amazon Athena
    • Amazon S3
    • Databricks
    • Dropbox
    • Files
    • Google Drive
    • Google BigQuery
    • Google Sheets
    • MariaDB
    • Microsoft SQL Server
    • MongoDB
    • MotherDuck
    • MySQL
    • Oracle Database
    • PostgreSQL
    • Redshift
    • Snowflake
    • Supabase
  • Guides
    • Publish a notebook
    • Importing data from flat files
    • Resizing plots
    • Show Bokeh and Pyvis plots
  • Resources
    • Pricing
    • Manage group settings
    • Reporting for Group Admins
    • DataLab for education
    • Technical requirements
    • Addressing slow code
    • Address R vulnerability
    • Get help
Powered by GitBook
On this page

Was this helpful?

  1. Work

Scheduled runs

PreviousVersion historyNextHiding and showing cells

Last updated 1 year ago

Was this helpful?

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
}