Automate notebook workflows
ArcGIS Notebook Server allows you to implement multiple methods of workflow automation, including automation through scheduled notebooks, webhooks, and your custom scripts using the Execute Notebook administrative API.
If you are preparing a notebook for an automated run, such as on a recurring basis, there are a few things to consider.
Prepare the notebook
The notebook editor has a Parameters option that allows you to configure input and output parameters for a notebook. Input parameters correspond to input variables in a notebook that you want to externalize for a scheduled task or a web tool. When a scheduled task runs, input parameters are inserted into the notebook at the top of the notebook, similar to global variables. This allows you to author generic notebooks and modify the values for input variables at run time.
When authoring a notebook, externalize and configure variables using the Parameters option. See the Configure input parameters section of the Publish a notebook as a web tool topic for information on how to set up input parameters for your notebook.
Task parameters are inserted by default into a cell at the beginning of a notebook. Alternatively, click View > Activate Command Palette in the menu and search for and open Edit Notebook Metadata, which allows you to edit cell and notebook metadata to create a tag for a cell named injected-parameters. Task parameters are inserted into the cell that follows the injected-parameters tag.
Considerations for content
Other than the parameters cell it can insert, scheduling a notebook does not support user interaction with notebooks. Avoid adding content that requires user interaction while the notebook runs, such as clicking a point on a map.
Any credentials or new variables you want added at the time of an automated run must be inserted in the parameters cell, as indicated above. Ensure that the notebook does not contain content that will stop the notebook from completing.
Note:
When authoring notebooks, use full paths to directories and files in the workspace directory.
For example, use /arcgis/home/test.gdb instead of home/test.gdb.
Run Notebook API
Administrators and notebook authors can also automate a notebook to run without user interaction by using the Execute Notebook operation in the ArcGIS Notebook Server Administrator Directory. This operation will automatically run a notebook when called, but by using a custom script, you can schedule it to run automatically to occur at a set time or on a regular schedule. A cron job or Windows scheduler can also be used to schedule the Execute Notebook operation to run at a set time or on a recurring interval.
To learn more, see the Execute Notebook operation topic in the Administrator Directory reference guide.