arcgis.gis.agonb module

AGOLNotebookManager

class arcgis.gis.agonb.AGOLNotebookManager(url, gis)

Bases: object

property containers

Provides the ability to manage containers and the notebooks within them

Returns

ContainerManager

property instance_preferences

Provides information about the available instances for notebooks

Returns

InstancePreference

property notebooksmanager

Manages the run and execution of notebooks

Returns

NotebookManager

property runtimes

Provides information about the available runtimes on the notebook server

Returns

RuntimeManager

property snaphots

Returns tools to work with snapshots on notebooks

Returns

SnapshotManager

ContainerManager

class arcgis.gis.agonb.ContainerManager(url, gis)

Bases: object

Parameter

Description

url

Required String. The base url for the ContainerManager endpoints.

gis

Required GIS. The ArcGIS Online connection object.

get(id)

Gets an instance of a container

list()

Returns a list of containers

start(runtime, instance_type=None)

starts a container

InstancePreference

class arcgis.gis.agonb.InstancePreference(url, gis)

Bases: object

Provides information about the available instances for notebook containers.

Parameter

Description

url

Required String. The base url for the InstancePreference endpoints.

gis

Required GIS. The ArcGIS Online connection object.

property available

Returns Information on the available notebook instances.

Returns

dict[T,V]

property instances

Returns a dictionary containing the available instance types for the system

Returns

dict[T,V]

NotebookManager

class arcgis.gis.agonb.NotebookManager(url, gis, nbs)

Bases: object

Provides access to managing a site’s notebooks. An object of this class can be created using notebooks property of the NotebookServer class

execute_notebook(item, update_portal_item=True, parameters=None, save_parameters=False, instance_type=None, timeout=50, future=False)

The Execute Notebook operation allows administrators to remotely run a notebook in their ArcGIS Notebook Server site. The notebook specified in the operation will be run with all cells in order.

Using this operation, you can schedule the execution of a notebook, either once or with a regular occurrence. This allows you to automate repeating tasks such as data collection and cleaning, content updates, and portal administration. On Linux machines, use a cron job to schedule the executeNotebook operation; on Windows machines, you can use the Task Scheduler app.

Note

To run this operation, you must be logged in with an ArcGIS Enterprise portal account. You cannot execute notebooks from the ArcGIS Notebook Server primary site administrator account.

You can specify parameters to be used in the notebook at execution time. If you’ve specified one or more parameters, they’ll be inserted into the notebook as a new cell. This cell will be placed at the beginning of the notebook, unless you have added the tag parameters to a cell.

Parameter

Description

item

Required Item. Opens an existing portal item.

update_portal_item

Optional Boolean. Specifies whether you want to update the notebook’s portal item after execution. The default is true. You may want to specify true when the notebook you’re executing contains information that needs to be updated, such as a workflow that collects the most recent version of a dataset. It may not be important to update the portal item if the notebook won’t store any new information after executing, such as an administrative notebook that emails reminders to inactive users.

parameters

Optional List. An optional array of parameters to add to the notebook for this execution. The parameters will be inserted as a new cell directly after the cell you have tagged parameters. Separate parameters with a comma. Use the format “x”:1 when defining parameters with numbers, and “y”:”text” when defining parameters with text strings.

save_parameters

Optional Boolean. Specifies whether the notebook parameters cell should be saved in the notebook for future use. The default is false.

instance_type

Optional String. The instance type.

timeout

Optional Int. The number of minutes to run the instance before timeout.

future

Optional boolean. If True, a Job object will be returned and the process will not wait for the task to complete. The default is False, which means wait for results.

Returns

Dict, else If future = True, then the result is a concurrent.futures.Future object. Call result() to get the response

open_notebook(itemid, templateid=None, nb_runtimeid=None, template_nb=None, instance_type=None, *, future=False)

Opens a notebook on the notebook server

Parameter

Description

itemid

Required String. Opens an existing portal item.

templateid

Optional String. The id of the portal notebook template. To get the system templates, look at the sample notebooks group:

>>> from arcgis.gis import GIS
>>> gis = GIS()
>>> grp = gis.groups.search("title:(esri sample notebooks) AND
>>>                                 owner:"esri_notebook")[0]
>>> grp.content

nb_runtimeid

Optional String. The runtime to use to generate a new notebook.

template_nb

Optional String. The start up template for the notebook.

instance_type

Optional String. The name of the instance type.

future

Optional Bool.

Returns

Dict

RuntimeManager

class arcgis.gis.agonb.RuntimeManager(url, gis)

Bases: object

Provides information about the Runtimes in the Notebook Server

Parameter

Description

url

Required String. The base url for the RuntimeManager endpoints.

gis

Required GIS. The ArcGIS Online connection object.

list()

returns a list of runtimes on the system

Returns

list[dict[T,V]]

manifest(id)

returns a dictionary containing all the libraries for that runtime

Returns

dict[T,V]

property properties

Returns the runtimes on the GIS

Returns

dict[T,V]

SnapshotManager

class arcgis.gis.agonb.SnapshotManager(url, gis)

Bases: object

Allows for management and creation of snapshots (save points) for ArcGIS Notebooks.

create(item, name, description=None, notebook_json=None, access=False)

Creates a Snapshot of a Given Item.

Parameter

Description

item

Required Item. The ‘Notebook’ typed item to create a snapshot for.

name

Required String. The name of the snapshot. This is the identifier used to identify the snapshot.

description

Optional String. An piece of text that describes the snapshot.

notebook_json

Optional Dict. If you want to store different JSON text other than what is in the current notebook provide it here.

access

Optional Bool. When false, the snapshot will not be publicly available.

Returns

Dict

list(item)

Returns a list of SnapShots for a notebook item.

Parameter

Description

item

Required Item. The Notebook Item to get all snapshots for.

Returns

List of SnapShot objects

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.