arcgis.gis.nb module

NotebookServer

class arcgis.gis.nb.NotebookServer(url, gis)

Bases: object

Provides access to the ArcGIS Notebook Server administration API.

property health_check

The health_check verifies that your ArcGIS Notebook Server site has been created, and that its Docker environment has been correctly configured.

This is only avaible if the site can be accessed around the web adapter

Returns

boolean

property info

Returns information about the server site itself

Returns

PropertyMap

property logs

Provides access to the notebook server’s logging system

Returns

LogManager

property machine

Provides access to managing the registered machines with ArcGIS Notebook Server

Returns

MachineManager

property notebooks

Provides access to managing the ArcGIS Notebook Server’s Notebooks

Returns

NotebookManager

property properties

Properties of the object

property security

Provides access to managing the ArcGIS Notebook Server’s security settings.

Returns

SecurityManager

property site

Provides access to the notebook server’s site management operations

Returns

SiteManager

property system

returns access to the system properties of the ArcGIS Notebook Server

Returns

SystemManager

property url

The URL of the notebook server.

property version

Returns the notebook server version

Returns

List

NotebookManager

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

Bases: object

Provides access to managing a site’s notebooks

execute_notebook(item, update_portal_item=True, parameters=None, save_parameters=False, 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.

Returns

Boolean

list()

Returns a list of notebook instances on the Notebook Server

Returns

List of Notebook Objects

open_notebook(itemid, templateid=None, nb_runtimeid=None, template_nb=None)

Opens a notebook on the notebook server

Argument

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.

Returns

dict

property properties

returns the properties of the resource

restore_runtime()

This operation restores the two default notebook runtimes in ArcGIS Notebook Server - ArcGIS Notebook Python 3 Standard and ArcGIS Notebook Python 3 Advanced - to their original settings.

property runtimes

Returns a list of all runtimes

Returns

List

Notebook

class arcgis.gis.nb.Notebook(url, item_id, properties=None, gis=None)

Bases: object

This represents an individual notebook resource in the notebook server.

close()

This operation stops a running notebook. You can use it to free up space in your notebook container. Idle notebooks are automatically cleaned up according to the duration defined by the idleNotebookThreshold property. The default value for that property is 24 hours.

Returns

Boolean

property properties

returns the properties of the resource

Runtime

class arcgis.gis.nb.Runtime(url, gis)

Bases: object

Provides information about the properties of a specific notebook runtime in your ArcGIS Notebook Server site

delete()

Deletes the current runtime from the ArcGIS Notebook Server

Returns

boolean

property manifest

This resource returns a JSON representation of all the Python libraries supported in the specified notebook runtime. Notebook authors who open notebooks using this runtime are able to import any of the libraries in the manifest into their notebooks.

Returns

List of Dictionaries

property properties

returns the properties of the resource

update(name=None, image_id=None, max_cpu=None, max_memory=None, memory_unit=None, max_swap_memory=None, swap_memory_unit=None, shared_memory=None, docker_runtime=None, shared_unit=None, version=None, container_type=None, pull_string=None, require_advanced_priv=None, manifest=None)

This operation allows you to update the properties of a notebook runtime in ArcGIS Notebook Server. These settings will be applied to every container to which the runtime is applied.

You can use this operation to update the resource limits of the runtime, such as maximum CPU and maximum memory. You can also use it to extend either of the default notebook runtimes, in order to make additional Python modules available to your notebook authors, or as a step in making ArcGIS Notebook Server able to use graphical processing units (GPUs).