arcgis.gis.tasks module¶
TaskManager¶
-
class
arcgis.gis.tasks.
TaskManager
(url: str, user: arcgis.gis.User, gis: arcgis.gis.GIS)¶ Bases:
object
Provides the functions to create, update and delete scheduled tasks.
This operation is for Enterprise configuration 10.8.1+.
Argument
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.
-
property
all
¶ returns all the current user’s tasks
-
property
count
¶ Returns the number of tasks a user has
- Returns
Int
-
create
(item: arcgis.gis.Item, cron: str, task_type: str, occurences: int = 10, start_date: datetime.datetime = None, end_date: datetime.datetime = None, title: str = None, parameters: dict = None) → arcgis.gis.tasks._schedule.Task¶ Creates a new scheduled task for a notebook Item.
Argument
Description
item
Required Item. The item to schedule a task on.
cron
Required String. The CRON statement. This should be in the from of:
<minute> <hour> <day of month> <month> <day of week>
Example to run a task weekly, use: 0 0 * * 0
task_type
Required String. The platform to execute the notebook on. For notebook server tasks use: ExecuteNotebook, for Insights notebook use: UpdateInsightsWorkbook.
occurences
Optional Integer. The total number of instance that can run at a single time.
start_date
Optional Datetime. The begin date for the task to run.
start_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/Values that will be given to the notebook.
- Returns
Task
-
search
(item: arcgis.gis.Item = None, active: bool = None, types: str = None)¶ This property allows users to search for tasks based on criteria.
Argument
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. This can be ExecuteNotebook, or UpdateInsightsWorkbook.
- Returns
List of Tasks
-
property
Task¶
-
class
arcgis.gis.tasks.
Task
(url: str, gis: arcgis.gis.GIS)¶ Bases:
arcgis.gis.tasks._schedule.BaseTask
Represents a schduled task that can be modified for a user.
Argument
Description
url
Required string. The URL to the REST endpoint.
gis
Required GIS. The GIS object.
-
delete
() → bool¶ Removes the Task from the System.
- Returns
Boolean
-
enable
(enabled: bool) → bool¶ The enable method allows administrators to enable or disable the scheduled task..
Argument
Description
enabled
Required Boolean. If True, the status of the task is set to active. If False, the task is set active to False.
- Returns
Bool
-
property
runs
¶ Returns the Runs for the Task. The maximum number of runs returned is 30
- Returns
List
-
start
() → bool¶ Starts a task if it is actively running.
- Returns
Bool
-
stop
() → bool¶ Stops a task if it is actively running.
- Returns
Bool
-
update
(item: arcgis.gis.Item = None, cron: str = None, task_type: str = None, occurences: int = 10, start_date: datetime.datetime = None, end_date: datetime.datetime = None, title: str = None, parameters: dict = None, task_url: str = None, is_active: bool = None) → bool¶ Updates the current Task
Argument
Description
item
Optional Item. The item to update the schedule for.
cron
Optional String. The executution time syntax.
task_type
Optional String. The type of task. Two valid options 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.
- Returns
bool or Dict on error.
-
Run¶
-
class
arcgis.gis.tasks.
Run
(url: str, gis: arcgis.gis.GIS)¶ Bases:
arcgis.gis.tasks._schedule.BaseTask
Represents a single run of a scheduled task.
Argument
Description
url
Required string. The URL to the REST endpoint.
gis
Required GIS. The GIS object.
-
delete
() → bool¶ Removes the Task from the System.
- Returns
Boolean
-
update
(status: str = None, description: str = None)¶ Updates the Run’s Status Message and Result Message.
Argument
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.
- Returns
Bool
-