from seeq import spy
import pandas as pd

# Set the compatibility option so that you maximize the chance that SPy will remain compatible with your notebook/script
spy.options.compatibility = 189

Commands to schedule a notebook to run in the background.

This feature is only available for scheduling notebooks in Seeq Data Lab. You cannot use SPy to schedule content in Anaconda, AWS SageMaker, or any other Python environment.

Scheduling a notebook to run in the background is achieved by adding the following command near the beginning of your notebook:'every 6 hours')

This will cause the notebook that contains the command to run every six hours. This background execution is referred to as a job.

The notebook can do anything you want, and the cell output can be inspected by going into the _Job Results folder that is created upon the first execution of the job.


Scheduling jobs should be done with great care. Jobs consume CPU, memory, and disk space resources and can easily cause degraded performance on Seeq Server, Seeq Data Lab or an external system that you may be accessing.

If you are scheduling anything to run more frequent than every 15 minutes, you should probably discuss it with your Seeq administrator to make sure it’s OK to consume those resources on a continual basis.


To try it out, execute the following cell (this cell only!). Within 15 minutes, you will find that there is a _Job Results folder with an HTML file in it corresponding to the output of this notebook.'every 15 minutes')

The following line will cause the job to be unscheduled after the first time it runs, which is what we want for the purposes of this tutorial. We don’t want to consume resources unnecessarily!

You would omit this line in “real” scenarios, since you want the job to run more than once.

If you would like to schedule multiple jobs and parameterize them, check out the Parameterized Jobs example.

Below the scheduling command, you can add whatever code you would like. In this example, we will perform a trivial computation and push that into a Seeq Workbook Analysis.

pull_df = spy.pull({'Name': 'Area A_Temperature', 'Datasource Name': 'Example Data'}))
pull_df['Scheduling Example'] = pull_df['Area A_Temperature'].apply(lambda value: value + 10)
pull_df.drop(columns=['Area A_Temperature'], inplace=True)

When you’re working on debugging or improving your notebook, sometimes it’s convenient to prevent jobs for the notebook from executing in the background. You can add the suspend=True argument to your command to achieve that, and then you can remove the flag and execute the cell again to restart the job schedule.

Detailed Help

All SPy functions have detailed documentation to help you use them. Just execute help(spy.<func>) like you see below.