Bases: object
Provides the functions to create, update, delete and view task
objects.
Note
Available starting with ArcGIS Enterprise release 10.8.1, and ArcGIS Online.
Objects are not meant to be initialized directly, but instead are accessed using the tasks
property on a User
object:
>>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_profile") >>> task_mgr = gis.users.me.tasks >>> type(task_mgr) <class 'arcgis.gis.tasks._schedule.TaskManager'>
Parameter
Description
url
Required string. The URL to the REST endpoint.
user
Required User. The user to perform the Task management on.
gis
Required GIS. The GIS object.
returns all the current userâs tasks
List of Task
objects
Returns the number of tasks belonging to the User
.
Int
Creates a new scheduled task.
Parameter
Description
item
Required Item
. The item to schedule a task on.
cron
Required String. The CRON statement. This should be in the following format:
<minute> <hour> <day of month> <month> <day of week>`
Example to run a task weekly, use: 0 0 * * 0.
Note
See cron for details on valid values and meanings for symbols.
task_type
Required String. The type of task that will be executed against the specified _item_.
Values:
ExecuteNotebook
UpdateInsightsWorkbook
ExecuteSceneCook
ExecuteWorkflowManager
ExecuteReport,
GPService
RunDataPipeline
occurences
Optional Integer. The maximum number of times the task will run.
start_date
Optional Datetime. The begin date for the task to run.
end_date
Optional Datetime. The end date for the task to run.
title
Optional String. The title of the scheduled task.
parameters
Optional Dict. Optional collection of Key/Value pairs that will be inserted into the task run at time of request.
Note
Required when task_type argument is ExecuteSceneCook
# Usage Example: For a scene service >>> task_mgr = gis.users.me.tasks >>> task_output = task_mgr.create( ... parameters = { "service_url": <scene service URL>, "num_of_caching_service_instances": 2, #(2 instances are required) "layer": "{<list of scene layers to cook>}", #The default is all layers "update_mode": "PARTIAL_UPDATE_NODES" }, ... )
task_url
Optional String. The URL of the task of an asynchronous geoprocessing service on any of the federated servers of your portal.
Note
Required when task_type argument is GPService
Task
object
# Usage Example: Schedule a notebook to run every 15 minutes for 5 runs # starting March 8, 2025 at 1pm Pacific >>> import datetime as dt >>> import pytz >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_profile") >>> nb_item = gis.content.search("air_quality_regular_updates", "notebook")[0] >>> dt = dt.datetime(2025, 3, 8, 13, 0, 0) >>> pdt_tz = pytz.timezone("US/Pacific") >>> dt_pdt = pdt_tz.localize(dt) >>> tsk_mgr = gis.users.me.tasks >>> tsk_mgr.create( >>> item=nb_item, >>> cron= "*/15 * ? * 1,2,3,4,5,6,7", >>> task_type="ExecuteNotebook", >>> occurences=5, >>> start_date= dt_pdt, >>> title="data_index_update" >>> )
This property allows users to search for tasks based on criteria.
Parameter
Description
item
Optional Item
. The item to query tasks about.
active
Optional Bool. Queries tasks based on active status.
types
Optional String. The type of notebook execution for the item. Can be one of:
ExecuteNotebook
UpdateInsightsWorkbook
ExecuteSceneCook
ExecuteWorkflowManager
ExecuteReport
GPService
List of Task
objects
Bases: BaseTask
Represents a scheduled task
. These objects are not meant to be intialized directly, but instead are returned by the all
property or search()
method on the TaskManager
object.
# Usage example: Returning task objects for an item >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> task_mgr = gis.users.me.tasks >>> user_item = gis.content.get(<item_id>) >>> task_list = task_mgr.search(item=user_item) >>> task_list [<Task @ 3259ac1...afc154f>, <Task @ 10f7a74...3afa7de>, <Task @ 0e6dc28...32ac65b>] >>> t0 = task_list[0] >>> t0 <Task @ 3259ac1...afc154f>
Parameter
Description
url
Required string. The URL to the REST endpoint.
gis
Required GIS. The GIS object.
Removes the Task from the System.
Boolean
The enable method allows administrators to enable or disable the scheduled task..
Parameter
Description
enabled
Required Boolean. If True, the status of the task is set to active. If False, the task is set active to False.
Boolean
A dictionary-like object listing various properties of the task
object.
# Usage Example: Listing keys of the properties object for a task: >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> task_mgr = gis.users.me.tasks >>> tsk = task_mgr.search(item=my_item)[0] >>> list(tsk.properties.keys()) ['id', 'itemId', 'type', 'title', 'userId', 'cronSchedule', 'runIntervalSeconds', 'nextStart', 'maxOccurrences', 'created', 'updated', 'startDate', 'active', 'taskState']
Dictionary-like object of task properties.
Returns all runs for the task. The maximum number of runs returned is 30>
List of Run
objects.
Starts a task if it is actively running.
Boolean
Stops a task if it is actively running.
Boolean
Updates the current Task
Parameter
Description
item
Optional Item. The item to update the schedule for.
cron
Optional String. The executution time syntax.
task_type
Required String. The type of task, either executing a notebook or updating an Insights workbook, that will be executed against the specified item. For notebook server tasks use ExecuteNotebook
, for Insights notebook use: UpdateInsightsWorkbook
. Use ExecuteSceneCook
to cook scene tiles. Use ExecuteWorkflowManager
to run workflow manager tasks. Values: ExecuteNotebook, UpdateInsightsWorkbook, ExecuteSceneCook, ExecuteWorkflowManager, ExecuteReport, or GPService`ns are ``ExecuteNotebook` or UpdateInsightsWorkbook
occurences
Optional Integer. The maximum number of occurrences this task should execute.
start_date
Optional Datetime. The date/time when the task will begin executing.
end_date
Optional Datetime. The date/time when the task will stop executing.
title
Optional String. The name of the task.
parameters
Optional Dict. Additional key/value pairs for execution of notebooks.
task_url
Optional String. A response URL with a set of results.
is_active
Optional Bool. Determines if the tasks is currently running.
Boolean or Dict on error.
Bases: BaseTask
Represents a run of a scheduled task
. The objects are not meant to be initialized directly, but instead a list of runs are returned by the runs
property of task
objects.
Parameter
Description
url
Required string. The URL to the REST endpoint.
gis
Required GIS. The GIS object.
Removes the Task from the System.
Boolean
A dictionary-like object listing various properties of the run
object.
Updates the Runâs Status Message and Result Message.
Parameter
Description
status
Optional String. The status of the run. The allowed values are: scheduled, executing, succeeded, failed, or skipped.
description
Optional String. Updates the descriptive message associated with the current Run.
Boolean
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4