Summary
The WorkflowConnection object provides access to methods for creating or getting a Workflow Manager job.
Discussion
Jobs are created from a job type template. All of the properties for the new job are automatically inherited from the job type and can be updated after creation using the Job methods.
Properties
Property | Explanation | Data Type |
jtcPath (Read Only) | Returns the path to the workflow connection file (.jtc) in the ArcGIS Pro project. If there is an existing ArcGIS Pro connection, it will return the complete path to the workflow connection file. If a connection to the workflow manager database is created using Connect, the jtcPath property can be used to get the manually entered workflow connection path for establishing connection. | String |
Method Overview
Method | Explanation |
createJob ({job_type_id}, {job_type_name}, {job_type_description}, {callback}) | Creates a new job based on a job type. |
createSD (output_directory, service_name, {connection_file_path}, {folder_name}, {description}, {mininstances}, {maxinstances}, {maxusagetime}, {maxwaittime}, {maxidletime}) | Creates a Service Definition (.sd) file of the Workflow Manager service type that can be published to a specified GIS server. |
getJob (jobID) | Return a single job using its job ID. |
getQualifiedTableName (table_name) | Returns a fully qualified table name for a table in a Workflow Manager database. |
queryJobs (fields, tables, {aliases}, {where}, {order_by}) | Queries jobs based on criteria and returns a QueryResult object then allows access to a list of jobs and job properties that meet the criteria. |
Methods
createJob ({job_type_id}, {job_type_name}, {job_type_description}, {callback})
Parameter | Explanation | Data Type |
job_type_id | The ID of the job type from which to create a new job. | Integer |
job_type_name | The name of the job type from which to create a new job. | String |
job_type_description | The properties of the job type that can be customized and assigned to a new job being created, provided as the JobTypeDescription object. | JobTypeDescription |
callback | The callback argument is used when the job is set to automatically execute after being created. It passes a function that prompts the user for a response based on input from the step type. When executing a question step, for example, the callback takes the possible step response options and allows the user to choose the next step. It is also used when the next step in the workflow cannot be determined so a user can select the path to follow. | Function |
Return Value
Data Type | Explanation |
Job | Returns the job created as a Job. A list of Job objects is returned when multiple jobs are created by providing a list of Geometry objects in the JobTypeDescription and the LOI are not set to be unioned. |
To create a new job requires a job type name, a job type ID, or a job type description.
The following script creates two jobs in the Workflow Managerdatabase: one defined by the job type name and the other by the job type ID.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Create a Workflow Job of type Data Edits
job = conn.createJob(job_type_name="Data Edits")
# Create a Workflow Job of type 5
job2 = conn.createJob(job_type_id=5)
The following script creates a job in the Workflow Manager database using the customized job type description. The customized job description provides the LOI, assigns the job to a user, assigns a data workspace to the job, assigns a parent using the ID, assigns a parent job version, adds a prefix to the job, and assigns a version for the job.
import arcpy
import arcpywmx
# Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
# Create a polygon geometry for LOI
coordList = [[-105.0, 39.0], [-100.0, 39.0], [-100.0, 35.0], [-105.0, 35.0