Skip To Content

Schedule a notebook task

Starting at 10.8.1, you can create tasks to schedule the automated execution of a notebook. Each time your notebook is executed according to the schedule you set, the site opens a new container and runs the notebook without user control.

From the Tasks pane in the notebook editor, you can create one or multiple scheduled tasks to run the notebook. You can schedule it to run once in the future, or on a recurring basis - anywhere from once per minute to once every five months.

If you are preparing a notebook for automated execution, such as on a recurring basis, there are a few things to keep in mind.

Prepare your notebook

The scheduler offers the option to insert parameters as a new cell at execution time, such as account credentials or variables to define.

The operation uses the Tags cell toolbar option, which allows you to create and manage tags for each cell in the notebook workspace. You can change the cell toolbar options by clicking View > Cell Toolbar.

You can designate the place in the notebook where this new cell is added by adding the tag parameters to a cell in your notebook. The new cell is inserted after this cell. Only one cell with the parameters tag is recognized by the operation.

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.

Content to avoid

Other than the parameters cell it can insert, scheduling a notebook does not support any user interaction with notebooks. Avoid adding any content that requires user interaction while your notebook runs, such as clicking a point on a map.

Any credentials or new variables you want added at the time of automated execution must be inserted in the parameters cell, as shown above. Make sure your notebook does not contain any content that will stop the notebook from completing.

Create a task for your notebook

When your notebook is ready, you can create a task to schedule its execution. Using the Tasks pane in the notebook editor, you can create one or multiple tasks to automate execution of the notebook, and specify the task's schedule.

  1. Save your notebook with a title, if you haven't already. The Tasks pane should be available in the top ribbon of the notebook editor.
  2. Click Create Task to open the dialog.

    Note:
    You can also create tasks from the Tasks tab of the notebook's item details page.

  3. Provide a Title to describe your task schedule, such as Weekly data cleaning run.
  4. If there are any parameters you want to add into the notebook when it is executed by the task, provide them in the Parameters section. You must give a Key and its paired Value for each parameter. As an example, you might have a Key of mypassword and a Value of gis.rocks123. Click the + plus sign to save the parameter.

    Once you have added at least one parameter, the Save Parameters to Notebook option appears. If this option is selected, the cell inserted with your new parameter(s) will be saved to the notebook when it is run.

  5. Click Next to move to the Set task schedule details page. Here, you can specify the particular schedule for this task.

    Tip:
    When you change the value for Repeat Every, the options below will change to fit that denomination. For example, if you choose to Repeat Every Day, check boxes will appear for each day of the week.

  6. The Update Item on Completion option saves the notebook after each executed run. If you want to update the notebook with the results of each run, keep this option selected. If you do not want the notebook to be automatically updated, unselect the option.
  7. When you are satisfied with your title, optional parameters if applicable, and task schedule, click Create Task. The task will be made active, and will execute the notebook according to the schedule you've set.

If you want to have multiple schedules, perhaps with different parameters inserted, you can create more tasks for the notebook using the same workflow.

Work with existing tasks

Once a task has been created for your notebook, you can view the task's details and edit or delete it at any time. These options are available in the Tasks pane of the notebook editor or from the Tasks tab of the notebook's item details page.

In both of these locations, you can view all tasks for the notebook with the time each was created and when it was last modified, and its current status (Active or Complete).

Each task has four action icons in its row. You can click the View Task Details icon to review results of each individual run of the task. To make changes to the title, parameters, or schedule of the task, click the Edit Task icon. You can also pause an active task or resume a paused task. If you want to remove a task, click the Delete Task icon.

Changing ownership of a notebook will also change the ownership of that notebook's tasks. The tasks will be transferred to the new user in a disabled state. The new owner can enable the tasks from the Tasks pane of the notebook editor or from the Tasks tab of the notebook's item details page.

Tip:

Deleting a task also deletes the run history of the task. If you want to preserve an active task's history, consider pausing the task to stop further task runs.