arcgis.gis.agonb module
AGOLNotebookManager
- classarcgis.gis.agonb.AGOLNotebookManager(url:str,gis:GIS)
Bases:
object
- propertycontainers:ContainerManager
Provides the ability to manage containers and the notebooks within them
- Returns:
- propertyinstance_preferences:InstancePreference
Provides information about the available instances for notebooks
- Returns:
- propertynotebooksmanager:NotebookManager
Manages the run and execution of notebooks
- Returns:
- propertyruntimes:RuntimeManager
Provides information about the available runtimes on the notebook server
- Returns:
- propertysnaphots:SnapshotManager
Returns tools to work with snapshots on notebooks
- Returns:
ContainerManager
InstancePreference
- classarcgis.gis.agonb.InstancePreference(url:str,gis: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.
NotebookManager
- classarcgis.gis.agonb.NotebookManager(url,gis,nbs)
Bases:
object
Provides access to managing a site’s notebooks. An object of thisclass can be created using
notebooks
property of theNotebookServer
class- execute_notebook(item:Item,update_portal_item:bool=True,parameters:list|None=None,save_parameters:bool=False,instance_type:str|None=None,timeout:float|int=50,future:bool=False)
The Execute Notebook operation allows administrators to remotelyrun a notebook in their ArcGIS Notebook Server site. The notebookspecified 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 toautomate repeating tasks such as data collection and cleaning,content updates, and portal administration. On Linux machines, usea cron job to schedule the executeNotebook operation; on Windowsmachines, you can use the Task Scheduler app.
Note
To run this operation, you must be logged in with an ArcGISEnterprise portal account. You cannot execute notebooks fromthe ArcGIS Notebook Server primary site administratoraccount.
You can specify parameters to be used in the notebook at executiontime. If you’ve specified one or more parameters, they’ll beinserted into the notebook as a new cell. This cell will be placedat the beginning of the notebook, unless you have added the tagparameters to a cell.
Parameter
Description
item
Required
Item
. Opens an existing portal item.update_portal_item
Optional Boolean. Specifies whether you want to update thenotebook’s portal item after execution. The default is true. You maywant to specify true when the notebook you’re executing containsinformation that needs to be updated, such as a workflow thatcollects the most recent version of a dataset. It may not beimportant to update the portal item if the notebook won’t store anynew information after executing, such as an administrative notebookthat emails reminders to inactive users.
parameters
Optional List. An optional array of parameters to add to thenotebook for this execution. The parameters will be inserted as anew cell directly after the cell you have tagged
parameters
.Separate parameters with a comma. Use the format “x”:1 whendefining parameters with numbers, and “y”:”text” when definingparameters with text strings.save_parameters
Optional Boolean. Specifies whether the notebook parameters cellshould be saved in the notebook for future use. The default isfalse.
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 processwill 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 isaconcurrent.futures.Future object.Callresult()
to get the response
- open_notebook(itemid:str,templateid:str|None=None,nb_runtimeid:str|None=None,template_nb:str|None=None,instance_type:str|None=None,*,future:bool=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 thesystem templates, look at the sample notebooks group:
>>>fromarcgis.gisimportGIS>>>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
- classarcgis.gis.agonb.RuntimeManager(url:str,gis: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.
SnapshotManager
- classarcgis.gis.agonb.SnapshotManager(url:str,gis:GIS)
Bases:
object
Allows for management and creation of snapshots (save points) for ArcGIS Notebooks.
- create(item:Item,name:str,description:str|None=None,notebook_json:dict|None=None,access:bool=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 identifierused 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 otherthan what is in the current notebook provide it here.
access
Optional Bool. When false, the snapshot will not be publicly available.
- Returns:
Dict