サマリ
The Job object provides access to properties and methods to interact with a Workflow Manager job.
説明
A Job is a single unit of work that is carried out within an organization. It may have one or many people working on it. It can work with a single dataset, multiple dataset, or no data at all. A Job is created based off of a template known as a Job Type, which is configured with the desired properties and components (such as the Workflow and Maps) that will be used in the job.
特性
| プロパティ | 説明 | データ タイプ |
| assignedTo (読み書き) | The user name or group that the job is assigned to. | String |
| assignedType (読み書き) | The type of assignment for the job. Below is a list of valid strings to use when setting the job assignment. If an invalid string is used the job will default to unassigned.
| String |
| createdBy (読み書き) | The user name of the user who created the job. | String |
| createdDate (読み取り専用) | Returns the date the job was created. | DateTime |
| currentSteps (読み取り専用) | Returns a list of step IDs representing the steps that are active in the workflow. | List |
| description (読み書き) | The description of the job. | String |
| dueDate (読み書き) | The date the job was scheduled to end. | DateTime |
| endDate (読み取り専用) | Returns the date the job ended. | DateTime |
| hasAOI (読み取り専用) | Returns True when the job has an area of interest defined. | Boolean |
| id (読み取り専用) | Return's the job id. | Integer |
| jobTypeID (読み取り専用) | Gets the ID of the job type for the job. | Integer |
| name (読み書き) | The job's name. | String |
| owner (読み書き) | The user name of the user who owns the job. | String |
| parent (読み書き) | The ID of the parent job for the current job. | Integer |
| parentVersion (読み書き) | The name of the parent version of the job. | String |
| percentComplete (読み取り専用) | Returns the percent complete of the job. | Double |
| priority (読み書き) | The priority of the job. | Integer |
| startDate (読み書き) | The date the job was scheduled to start. | DateTime |
| startedDate (読み取り専用) | Returns the date the job was started. | DateTime |
| status (読み書き) | The status name for the job. The statuses available for use are those defined as status types in the Workflow Manager database. | String |
| versionExists (読み取り専用) | Returns True when a version exists for a job. | Boolean |
| versionName (読み書き) | The name of the version for the job. | String |
メソッドの概要
| メソッド | 説明 |
| getPendingDays (consider_hold) | Returns the number of days that the job has been pending. This can also optionally consider the holds and subtract them from the number of days the job was pending. |
| save () | Saves any changes made to the job back to the Workflow Manager database. |
| setAOI (aoi) | Sets the area of interest (AOI) polygon for the job. |
| setDataWorkspace (data_workspace_id) | Sets the data workspace for the job. |
メソッド
getPendingDays (consider_hold)
| パラメータ | 説明 | データ タイプ |
consider_hold | Flag to determine whether to consider the holds when calculating the number of pending days. | Boolean |
戻り値
| データ タイプ | 説明 |
| Integer | Returns the number of days the job has been pending. |
Pending days refers to the number of days the job has been worked on or the number of days the job has been pending before being completed. The start date used for the calculation is either the Start Date if it was set or the Created Date otherwise. The end date for the calculation is either the current date or the End Date if the job is closed.
The following script returns the number of pending days, both when considering and not considering holds in the calculation.
import arcpy
import arcpywmx
#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
#Access a Workflow Job
job = conn.getJob(99999)
#Get pending days for job while considering days on hold
pendingwithholds = job.getPendingDays(True)
print "The number of days pending for job when considering days on hold: " + str(pendingwithholds)
#Get pending days for job while ignoring days on hold
pendingwithoutholds = job.getPendingDays(False)
print "The number of days pending for job when ignoring days on hold: " + str(pendingwithholds)
save ()
The following script saves an updated job assignment.
import arcpy
import arcpywmx
#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
#Access a Workflow Job
job = conn.getJob(99999)
# Update and save the job assignment
job.assignedTo = 'user0000'
job.save()
setAOI (aoi)
| パラメータ | 説明 | データ タイプ |
aoi | The AOI polygon to be assigned to the job | Geometry |
Define's an area of interest for a job. To get a job's area of interest polygon, use the Get Job AOI tool.
The following script defines a polygon geometry and sets it as the job's area of interest.
import arcpy
import arcpywmx
#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
#Access a Workflow Job
job = conn.getJob(99999)
# Create polygon geometry
coordList = [[-105.0, 39.0], [-100.0, 39.0], [-100.0, 35.0], [-105.0, 35.0]]
array = arcpy.Array([arcpy.Point(x, y) for x, y in coordList])
aoi = arcpy.Polygon(array)
#Set the job's Area of interest to the polygon geometry
job.setAOI(aoi)
job.save()
setDataWorkspace (data_workspace_id)
| パラメータ | 説明 | データ タイプ |
data_workspace_id | The GUID of the data workspace to be made active for the job. | String |
Set the data workspace for a job. To get a job's data workspace, use the Get Job Data Workspace tool.
The following script sets a data workspace for a job.
import arcpy
import arcpywmx
#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')
#Access a Workflow Job
job = connect.getjob(99999)
#Set the job's data workspace to a workspace GUID
job.setDataWorkspace("{7887F5C8-CACD-4ADD-88E9-8B37E25C7FF6}")
コードのサンプル
The following script updates the assignment of a job and checks that a spatial data version exists by using the job's properties.
import arcpy
import arcpywmx
#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\sample\Workflow.jtc')
#Access a Workflow Job
job = conn.getJob(99999)
# Update the job assignment
job.assignedTo = 'user0000'
job.assignedType = 'user'
job.save()
# Reload the job
job = job.conn.getJob(99999)
#Check a version exists for the job and get the version name
if job.version == True:
jobversion = job.versionName
print "The job's data workspace is " + jobversion