Scheduling a notebook (Watson Studio)
You can create a job to run your notebook at periodic intervals.
Creating a notebook job
To schedule a notebook job:
- Click from the notebook’s menu bar and select Create a job.
- Define the job details by entering a name and a description (optional).
On the Configure page, select:
- A notebook version. The most recently saved version of the notebook is used by default. If no version of the notebook exists, you must create a version by clicking from the notebook action bar.
- A runtime. By default, the job uses the same environment definition that was selected for the notebook.
Advanced configuration to add environment variables or Python script arguments. For notebooks, you can select the run result output.
Add environment variables that are passed when the job is started and affect the execution of the notebook or script.
Each variable declaration must be made for a single variable in the following format and appear on its own line:
For example, to determine which data source to access if the same notebook is used in different jobs, you can set the variable
DATA_SOURCE=jdbc:db2//db2.server.com:1521/testdatain the notebook job that trains a model and to
DATA_SOURCE=jdbc:db2//db2.server.com:1521/productiondatain the job where the model runs on real data. In another example, the variables
EPOCHSthat are required for a Keras model can be passed to the same notebook with different values in separate jobs.
- Notebooks only: Select the job run result output. You can select:
- Log only to store the log file only. The resulting notebook is discarded. Select if you want to promote the notebook later.
- Log & notebook to store the log file and the resulting notebook. Select if you want to promote the notebook later.
- Log & updated version to store the log file and update the output cells of the version you used as input to this task. Select to share the result of the job run via “Share by URL”.
Python scripts only: Add arguments to use the same Python script in a variety of ways or for different use cases.
Each script argument must be entered in the following format and appear on its own line:
arg1 arg2 arg3
For example, you can define arguments to read the contents of different input tables and then run the script to generate the corresponding HTML reports, sometimes for test purposes and other times in production runs.
- Job run retention settings to set how long to retain finished job runs and job run artifacts like logs or notebook results. You can either select the number of days to retain the job runs or the last number of job runs to keep.
On the Schedule page, you can optionally add a one-time or repeating schedule.
If you define a start day and time without selecting Repeat, the job will run exactly one time at the specified day and time. If you define a start date and time and you select Repeat, the job will run for the first time at the timestamp indicated in the Repeat section.
You can’t change the time zone; the schedule uses your web browser’s time zone setting. If you exclude certain weekdays, the job might not run as you would expect. The reason might be due to a discrepancy between the time zone of the user who creates the schedule, and the time zone of the compute node where the job runs.
- Optionally set to see notifications for the job. You can select the type of alerts to receive.
Review the job settings. Then create the job and run it immediately, or create the job and run it later. All notebook code cells are run and all output cells are updated.
The notebook job is listed under Jobs in your project.
You can view the other jobs associated with your notebook and the job details:
- From an opened notebook by clicking from the notebook’s menu bar and selecting Save and view jobs. If more than one job exists for a notebook, select which job details to view.
- From the Jobs tab of your project by clicking the jobs associated with your notebook.
Editing a notebook job
You can edit job settings, for example the schedule settings or pick another environment definition.
To edit a notebook job:
- Click from the notebook’s menu bar and select Save and view jobs.
- Select the job and click Edit job to change job settings.