arcgis.gis.workflowmanager module¶
The arcgis.workflowmanager module contains classes and functions for working with a Workflow Manager installation. Workflow diagrams, job templates and jobs can be created, modified, or deleted. Information such as location, assignment, history and attachments for individual jobs can be accessed. Additionally, information about the various roles, users, groups, and searches can be view, modified or created.
WorkflowManager¶
-
class
arcgis.gis.workflowmanager.
WorkflowManager
(item)¶ Bases:
object
Represents a connection to a Workflow Manager instance or item.
Users create, update, delete workflow diagrams, job templates and jobs or the various other properties with a workflow item.
Argument
Description
item
Required string. The Workflow Manager Item
# USAGE EXAMPLE: Creating a WorkflowManager object from a workflow item from arcgis.workflow import WorkflowManager from arcgis.gis import GIS # connect to your GIS and get the web map item gis = GIS(url, username, password) wf_item = gis.content.get('1234abcd_workflow item id') # create a WorkflowManager object from the workflow item wm = WorkflowManager(wf_item) type(wm) >> arcgis.workflowmanager.WorkflowManager # explore the users in this workflow using the 'users' property wm.users >> [{}...{}] # returns a list of dictionaries representing each user
-
property
assignable_groups
¶ Get portal groups associated with Workflow Manager roles, to which the current user can assign work based on their Workflow Manager assignment privileges.
-
property
assignable_users
¶ Get all assignable users for a user in the workflow system
- Returns
A list of the assignable
user
objects
-
create_diagram
(name, steps, display_grid, description='', active=False, annotations=[], data_sources=[], diagram_id=None)¶ Adds a diagram to the Workflow Manager instance given a user-defined name and array of steps
Argument
Description
name
Required string. Diagram Name
steps
Required list. List of Step objects associated with the Diagram
display_grid
Required boolean. Boolean indicating whether the grid will be displayed in the Diagram
description
Optional string. Diagram description
active
Optional Boolean. Indicates whether the Diagram is active
annotations
Optinal list. List of Annotation objects associated with the Diagram
data_sources
Optional list. List of Data Source objects associated with the Diagram
diagram_id
Optional string. The unique ID of the diagram to be created.
- Returns
-
create_job_template
(name, priority, id=None, category='', job_duration=0, assigned_to='', default_due_date=None, default_start_date=None, start_date_type='CreationDate', diagram_id='', diagram_name='', assigned_type='Unassigned', description='', default_description='', state='Draft', last_updated_by='', last_updated_date=None, extended_property_table_definitions=[])¶ Adds a job template to the Workflow Manager instance given a user-defined name and default priority level
Argument
Description
name
Required string. Job Template Name
priority
Required string. Default Job Template Priority Level
id
Optional string. Job Template ID
category
Optional string. Job Template Category
job_duration
Optional string. Default Job Template Duration
assigned_to
Optional string. Job Owner
default_due_date
Optional string. Due Date for Job Template
default_start_date
Optional string. Start Date for Job Template
start_date_type
Optional string. Type of Start Date (e.g. creationDate)
diagram_id
Optional string. Job Template Diagram ID
diagram_name
Optional string. Job Template Diagram Name
assigned_type
Optional string. Type of Job Template Assignment
description
Optional string. Job Template Description
default_description
Optional string. Default Job Template Description
state
Optional string. Default Job Template State
last_updated_by
Optional string. User Who Last Updated Job Template
last_updated_date
Optional string. Date of Last Job Template Update
extended_property_table_definitions
Optional list. List of Extended Properties for Job Template
- Returns
Workflow Manager
JobTemplate
ID
-
create_lookup
(lookup_type, lookups)¶ Adds a diagram to the Workflow Manager instance given a user-defined name and array of steps
Argument
Description
lookup_type
Required string. The type of lookup table stored in the workflow item.
lookups
Required list. List of lookups to be created / updated
- Returns
boolean
# USAGE EXAMPLE: Creating a Lookup Table # create a WorkflowManager object from the workflow item wm = WorkflowManager(wf_item) # create the lookups object lookups = [{"lookupName": "Low", "value": 0}, {"lookupName": "Medium", "value": 5}, {"lookupName": "High", "value": 10}, {"lookupName": "EXTRA", "value": 15}, {"lookupName": "TEST", "value": 110}] wm.create_lookup("priority", lookups) >> True # returns true if created successfully
-
create_wm_role
(name, description='', privileges=[])¶ Adds a role to the Workflow Manager instance given a user-defined name
Argument
Description
name
Required string. Role Name (required)
description
Required string. Role Description
privileges
Required list. List of privileges associated with the role
- Returns
Workflow Manager
Role
Object
-
delete_diagram
(id)¶ Deletes a diagram object by ID
Argument
Description
id
Required string. Diagram id
- Returns
-
delete_diagram_version
(diagram_id, version_id)¶ Deletes a diagram version by ID
Argument
Description
diagram_id
Required string. Diagram ID
version_id
Required string. Diagram Version ID
- Returns
boolean
-
delete_job_template
(id)¶ Deletes a job template with the given ID
Argument
Description
id
Required string. Job Template ID
- Returns
status code
-
delete_lookup
(lookup_type)¶ Deletes a job template with the given ID
Argument
Description
lookup_type
Required string. The type of lookup table stored in the workflow item.
- Returns
status code
-
diagram
(id)¶ Returns the
diagram
with the given IDArgument
Description
id
Required string. Diagram ID
- Returns
Workflow Manager
JobDiagram
Object
-
diagram_version
(diagram_id, version_id)¶ Returns the
diagram
with the given version IDArgument
Description
diagram_id
Required string. Diagram ID
version_id
Required string. Diagram Version ID
- Returns
Specified version of the Workflow Manager
JobDiagram
object
-
property
diagrams
¶ Gets the workflow diagrams within the workflow item.
-
evaluate_arcade
(expression, context=None, context_type='BaseContext', mode='Standard')¶ Evaluates an arcade expression
Argument
Description
expression
Required String.
context
Optional String.
context_type
Optional String.
mode
Optional String.
- Returns
String
-
group
(group_id)¶ Returns group information with the given group ID
Argument
Description
group_id
Required string. Workflow Manager Group ID
- Returns
Workflow Manager
Group
Object
-
job_template
(id)¶ Returns a job template with the given ID
Argument
Description
id
Required string. Job Template ID
- Returns
Workflow Manager
JobTemplate
Object
-
property
job_templates
¶ Gets all the job templates in a workflow item.
- Returns
List of all current
job templates
in the Workflow Manager (required information for create_job call).
-
property
jobs
¶ The job manager for a workflow item.
- Returns
JobManager
object
-
lookups
(lookup_type)¶ Returns LookUp Tables by given type
Argument
Description
lookup_type
Required string. The type of lookup table stored in the workflow item.
- Returns
Workflow Manager
LookUpTable
Object
-
property
saved_searches
¶ The Saved Searches manager for a workflow item.
- Returns
-
searches
(search_type=None)¶ Returns a list of all saved searches.
Argument
Description
search_type
Optional string. The search type for returned saved searches. The accepted values are Standard, Chart, and All. If not defined, the Standard searches are returned.
- Returns
-
property
table_definitions
¶ Get the definitions of each extended properties table in a workflow item. The response will consist of a list of table definitions. If the extended properties table is a feature service, its definition will include a dictionary of feature service properties. Each table definition will also include definitions of the properties it contains and list the associated job templates. This requires the adminBasic or adminAdvanced privileges.
- Returns
-
update_diagram
(body, delete_draft=True)¶ Updates a diagram object by ID
Argument
Description
body
Required object. Diagram body - existing Diagram object that inherits required/optional fields.
delete_draft
Optional Boolean - option to delete the Diagram draft (optional)
- Returns
success object
-
update_group
(group_id, update_object)¶ Update the information to the portal group. The adminAdvanced privilege is required. New roles can be added to the portal group. Existing roles can be deleted from the portal group.
Argument
Description
group_id
Required string.
Workflow Manager Group
IDupdate_object
Required object. Object containing the updated actions of the information to be taken to the portal group.
- Returns
boolean
-
update_job_template
(template)¶ Updates a job template object by ID
Argument
Description
body
Required object.
Job Template
body. Existing Job Template object that inherits required/optional fields.- Returns
success object
-
update_settings
(props)¶ Returns an active job with the given ID
Argument
Description
props
Required list. A list of Props objects to update (Prop object example: {‘propName’: ‘string’, ‘value’: ‘string’})
- Returns
success object
-
user
(username)¶ Returns a user profile with the given username
Argument
Description
username
Required string. Workflow Manager Username
- Returns
Workflow Manager user profile
-
property
users
¶ Returns an list of all user profiles stored in Workflow Manager
- Returns
List of
user
profiles
-
property
WorkflowManagerAdmin¶
-
class
arcgis.gis.workflowmanager.
WorkflowManagerAdmin
(gis)¶ Bases:
object
Represents a series of CRUD functions for Workflow Manager Items
Argument
Description
gis
Optional GIS. The connection to the Enterprise.
-
create_item
(name) → tuple¶ Creates a Workflow Manager schema that stores all the configuration information and location data in the data store on Portal. This can be run by any user assigned to the administrator role in Portal.
For users that do not belong to the administrator role, the following privileges are required to run Create Workflow Item:
Argument
Description
name
Required String. The name of the new schema.
- Returns
string (item_id)
-
delete_item
(item)¶ Delete a Workflow Manager schema. Does not delete the Workflow Manager Admin group. Requires the administrator or publisher role. If the user has the publisher role, the user must also be the owner of the item to delete.
Argument
Description
id
Required Item. The Workflow Manager Item to be deleted
- Returns
success object
-
property
health_check
¶ Checks the health of Workflow Manager Server and if the cluster is active (if applicable).
- Returns
boolean
-
property
server_status
¶ Gets the current status of the Workflow Manager Server
- Returns
boolean
-
upgrade_item
(item)¶ Upgrades an outdated Workflow Manager schema. Requires the Workflow Manager Advanced Administrator privilege or the Portal Admin Update Content privilege.
Argument
Description
item
Required Item. The Workflow Manager Item to be upgraded
- Returns
success object
-
JobManager¶
-
class
arcgis.gis.workflowmanager.
JobManager
(item)¶ Bases:
object
Represents a helper class for workflow manager jobs. Accessible as the
jobs
property of theWorkflowManager
.Argument
Description
item
The Workflow Manager Item
-
close
(job_ids)¶ Closes a single or multiple jobs with specific Job IDs
Argument
Description
job_ids
Required list of job ID strings
- Returns
success object
-
create
(template, count=1, name=None, start=None, end=None, priority=None, description=None, owner=None, group=None, assigned=None, complete=None, notes=None, parent=None, location=None, extended_properties=None, related_properties=None, job_id=None)¶ Adds a job to the Workflow Manager instance given a user-defined template
Argument
Description
template
Required object. Workflow Manager Job Template ID
count
Optional Integer Number of jobs to create
name
Optional string. Job Name
start
Optional string. Job Start Date
end
Optional string. Job End Date
priority
Optional string. Job Priority Level
description
Optional string. Job Description
owner
Optional string. Job Owner
group
Optional string Job Group
assigned
Optional string. Initial Job Assignee
complete
Optional Integer Percentage Complete
notes
Optional string. Job Notes
parent
Optional string Parent Job
location
Optional Geometry. Define an area of location for your job.
extended_properties
Optional Dict. Define additional properties on a job template specific to your business needs.
related_properties
Optional Dict. Define additional 1-M properties on a job template specific to your business needs.
job_id
Optional string. Define the unique jobId of the job to be created. Once defined, only one job can be created.
- Returns
Workflow Manager
Job
-
delete
(job_ids)¶ Deletes a single or multiple jobs with specific JobIDs
Argument
Description
job_ids
Required list. A list of job ID strings
- Returns
success object
-
delete_attachment
(job_id, attachment_id)¶ Deletes a job attachment given a job ID and attachment ID
Argument
Description
job_id
Required string. Job ID
attachment_id
Required string. Attachment ID
- Returns
status code
-
diagram
(id)¶ Returns the job diagram for the user-defined job
Argument
Description
id
Required string. Job ID
- Returns
Workflow Manager
Job Diagram
object
-
get
(id, get_ext_props=True)¶ Returns an active job with the given ID
Argument
Description
id
Required string. Job ID
get_ext_props
Optional Boolean. If set to true will show the jobs extended properties.
- Returns
Workflow Manager
Job
Object
-
reopen
(job_ids)¶ Reopens a single or multiple jobs with specific Job IDs
Argument
Description
job_ids
Required list of job ID strings
- Returns
success object
-
search
(query=None, search_string=None, fields=None, display_names=[], sort_by=[], num=10, start_num=0)¶ Runs a search against the jobs stored inside the Workflow Manager instance
Argument
Description
query
Required string. SQL query to search against (e.g. “priority=’High’”)
search_str
Optional string. Search string to search against (e.g. “High”)
fields
Optional string. Field list to return
display_names
Optional string. Display names for the return fields
sort_by
Optional string. Field to sort by (e.g. {‘field’: ‘priority’, ‘sortOrder’: ‘Asc’})
num
Optional Integer. Number of return results
start_num
Optional string. Index of first return value
- Returns
List of search results
-
set_job_location
(job_id, geometry)¶ Set a location of work for an existing job. jobUpdateLocation privilege is required to set a location on a job.
Arguments
Description
job_id
Required string. ID for the job to update
geometry
Required ArcGIS.Geometry.Geometry that describes a Job’s Location. Must be a Polygon, Polyline, or Multipoint geometry type
- Returns
success object
-
update
(job_id, update_object)¶ Updates a job object by ID
Argument
Description
job_id
Required string. ID for the job to update
update_object
Required object. An object containing the fields and new values to add to the job
- Returns
success object
# USAGE EXAMPLE: Updating a Job's properties # create a WorkflowManager object from the workflow item >>> workflow_manager = WorkflowManager(wf_item) >>> job = workflow_manager.jobs.get(job_id) >>> job.priority = 'Updated' >>> table_name = job.extended_properties[0]["tableName"] >>> job.extended_properties = [ { "identifier": table_name + ".prop1", "value": "updated_123" }, { "identifier": table_name + ".prop2", "value": "updated_456" }, ]
>>> workflow_manager.jobs.update(job_id, vars(job))
-
upgrade
(job_ids)¶ Upgrades a single or multiple jobs with specific JobIDs
Argument
Description
job_ids
Required list. A list of job ID strings
- Returns
success object
-
Job¶
-
class
arcgis.gis.workflowmanager.
Job
(init_data, gis=None, url=None)¶ Bases:
object
Helper class for managing Workflow Manager jobs in a workflow item. This class is not created by users directly. An instance of this class, can be created by calling the
get
method of theJob Manager
with the appropriate job ID. TheJobManager
is accessible as thejobs
property of theWorkflowManager
.-
add_attachment
(attachment, alias=None, folder=None)¶ Adds an attachment to the job
Argument
Description
attachment
Filepath to attachment
alias
Optional string. Alias for the attachment
folder
Optional string. Folder for the attachment
- Returns
Job Attachment
-
add_comment
(comment)¶ Adds a comment to the job
Argument
Description
comment
Required string. Comment to add to job
- Returns
Workflow Manager Comment Id
-
add_linked_attachment
(attachments)¶ Add linked attachments to a job to provide additional or support information related to the job. Linked attachments can be links to a file on a local or shared file system or a URL. jobUpdateAttachments privilege is required to add an attachment to a job.
Argument
Description
attachments
List of linked attachments to associate with the job. Each attachment should define the url, alias and folder
- Returns
List list of job attachments
-
get_attachment
(attachment_id)¶ Returns an embedded job attachment given an attachment ID
Argument
Description
attachment_id
Attachment ID
- Returns
Job Attachment
-
property
history
¶ Gets the history of a job given job ID
- Returns
success object
-
property
location
¶ Get/Set the job location for the user-defined job
- Returns
Workflow Manager
JobLocation
object
-
set_current_step
(step_id)¶ Sets a single step to be the active step on the job. The ability to set a step as current is controlled by the workflowSetStepCurrent privilege.
Argument
Description
step_id
Active Step ID
- Returns
success object
-
update_attachment
(attachment_id, alias)¶ Updates an attachment alias given a Job ID and attachment ID
Argument
Description
attachment_id
Attachment ID
alias
Alias
- Returns
success
-
update_step
(step_id, assigned_type, assigned_to)¶ Update the assignment of the current step in a job based on the current user’s Workflow Manager assignment privileges
Argument
Description
step_id
Active Step ID
assigned_type
Type of assignment designated (NOTE: Must be User, Group or Unassigned)
assigned_to
User to which the active step is assigned
- Returns
success object
-
JobDiagram¶
-
class
arcgis.gis.workflowmanager.
JobDiagram
(init_data, gis=None, url=None)¶ Bases:
object
Helper class for managing Workflow Manager
job diagrams
in a workflowitem
. This class is not created directly. An instance can be created by calling thediagrams
property of theWorkflowManager
to retrieve a list of diagrams. Then thediagram()
method can be used with the appropriate ID of the digram to retrieve thejob diagram
.
JobLocation¶
-
class
arcgis.gis.workflowmanager.
JobLocation
(init_data)¶ Bases:
object
Represents a Workflow Manager Job Location object with accompanying GET, POST, and DELETE methods
Argument
Description
init_data
Required object. Represents. relevant parameters for GET or POST calls
JobTemplate¶
-
class
arcgis.gis.workflowmanager.
JobTemplate
(init_data, gis=None, url=None)¶ Bases:
object
Represents a Workflow Manager Job Template object with accompanying GET, POST, and DELETE methods
Argument
Description
init_data
data object representing relevant parameters for GET or POST calls
-
automated_creation
(automation_id)¶ Returns the specified automated creation
Argument
Description
automation_id
Required string. Automation Creation Id
- Returns
automated creation object.
-
property
automated_creations
¶ Retrieve the list of created automations for a job template, including scheduled job creation and webhook.
- Returns
list of automatedCreations associated with the JobTemplate
Shares a job template with the list of groups
Argument
Description
group_ids
Required list. List of Workflow Group Ids
- Returns
boolean
Returns the list of groups that the job_template is shared with by template_id.
- Returns
list of
Group
ID
-
update_automated_creation
(adds=None, updates=None, deletes=None)¶ Creates an automated creation
Argument
Description
adds
Optional List. The list of automated creations to create.
updates
Optional List. The list of automated creations to update
deletes
Optional List. The list of automated creation ids to delete
- Returns
success object
# USAGE EXAMPLE: Creating a automated creation for a job template # create a WorkflowManager object from the workflow item wm = WorkflowManager(wf_item) # create the props object with the required automation properties adds = [{ "automationName": "auto_mation", "automationType": "Scheduled", "enabled": True, "details": "{"timeType":"NumberOfDays","dayOfMonth":1,"hour":8,"minutes":0}" }] updates = [ { "automationId": "abc123", "automationName": "automation_updated" } ] deletes = ["def456"] wm.update_automated_creation(adds, updates, deletes) >> True # returns true if created successfully
-
Group¶
-
class
arcgis.gis.workflowmanager.
Group
(init_data)¶ Bases:
object
Represents a Workflow Manager Group object with accompanying GET, POST, and DELETE methods
Argument
Description
init_data
data object representing relevant parameters for GET or POST calls
SavedSearchesManager¶
-
class
arcgis.gis.workflowmanager.
SavedSearchesManager
(item)¶ Bases:
object
Represents a helper class for workflow manager saved searches. Accessible as the
saved_searches
property.Argument
Description
item
The Workflow Manager Item
-
create
(name, search_type, folder=None, definition=None, color_ramp=None, sort_index=None, search_id=None)¶ Create a saved search or chart by specifying the search parameters in the json body. All search properties except for optional properties must be passed in the body to save the search or chart. The adminAdvanced or adminBasic privilege is required.
Argument
Description
name
Required string. The display name for the saved search or chart.
search_type
Required string. The type for the saved search or chart. The accepted values are Standard, Chart and All.
folder
Optional string. The folder the saved search or chart will be categorized under.
definition
Required string. if the searchType is Standard. The search definition to be saved.
color_ramp
Required string. if the searchType is Chart. The color ramp for the saved chart.
sort_index
Optional string. The sorting order for the saved search or chart.
search_id
Optional string. The unique ID of the search or chart to be created.
- Returns
Saved Search ID
-
delete
(id)¶ Deletes a saved search by ID
Argument
Description
id
Required string. Saved Search id
- Returns
boolean
Shares a saved search with the list of groups
Argument
Description
search_id
Required string. Saved Search id
group_ids
Required list. List of Workflow Group Ids
- Returns
boolean
Returns the list of groups that the saved search is shared with by searchId.
Argument
Description
search_id
Search ID
- Returns
list of
Group
ID
-
update
(search)¶ Update a saved search or chart by specifying the update values in the json body. All the properties except for optional properties must be passed in the body to update the search or chart. The searchId cannot be updated once it is created. The adminAdvanced or adminBasic privilege is required.
Arguments
Description
search
Required object. An object defining the properties of the search to be updated.
- Returns
success object
# USAGE EXAMPLE: Updating a Job's properties # create a WorkflowManager object from the workflow item >>> workflow_manager = WorkflowManager(wf_item) >>> workflow_manager.create_saved_search(name="name", definition={ "start": 0, "fields": ["job_status"], "displayNames": ["Status" ], "sortFields": [{"field": "job_status", "sortOrder": "Asc:}] }, search_type='Chart', color_ramp='Flower Field Inverse', sort_index=2000) >>> search_lst = workflow_manager.searches("All") >>> search = [x for x in search_lst if x["searchId"] == searchid][0] >>> search["colorRamp"] = "Default" >>> search["name"] = "Updated search" >>> actual = workflow_manager.update_saved_search(search)
-
LookUpTable¶
-
class
arcgis.gis.workflowmanager.
LookUpTable
(init_data, gis=None, url=None)¶ Bases:
object
Represents a Workflow Manager Look Up object with accompanying GET, POST, and DELETE methods.
Argument
Description
init_data
data object containing the relevant properties for a LookUpTable to complete REST calls
WMRole¶
-
class
arcgis.gis.workflowmanager.
WMRole
(init_data)¶ Bases:
object
Represents a Workflow Manager Role object with accompanying GET, POST, and DELETE methods
Argument
Description
init_data
data object representing relevant parameters for GET or POST calls