ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Job

  • Summary
  • Discussion
  • Properties
  • Method Overview
  • Methods
  • Code Sample

Summary

The Job object provides access to properties and methods to interact with a Workflow Manager job.

Discussion

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.

Properties

PropertyExplanationData Type
assignedTo
(Read and Write)

The user name or group that the job is assigned to.

String
assignedType
(Read and Write)

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.

  • User —A user in the workflow database
  • Group —A group in the workflow database
  • Unassigned —No job assignment
String
createdBy
(Read and Write)

The user name of the user who created the job.

String
createdDate
(Read Only)

Returns the date the job was created.

DateTime
currentSteps
(Read Only)

Returns a list of step IDs representing the steps that are active in the workflow.

List
description
(Read and Write)

The description of the job.

String
dueDate
(Read and Write)

The date the job was scheduled to end.

DateTime
endDate
(Read Only)

Returns the date the job ended.

DateTime
hasAOI
(Read Only)

Returns True when the job has an area of interest defined.

Boolean
id
(Read Only)

Return's the job id.

Integer
jobTypeID
(Read Only)

Gets the ID of the job type for the job.

Integer
name
(Read and Write)

The job's name.

String
owner
(Read and Write)

The user name of the user who owns the job.

String
parent
(Read and Write)

The ID of the parent job for the current job.

Integer
parentVersion
(Read and Write)

The name of the parent version of the job.

String
percentComplete
(Read Only)

Returns the percent complete of the job.

Double
priority
(Read and Write)

The priority of the job.

Integer
startDate
(Read and Write)

The date the job was scheduled to start.

DateTime
startedDate
(Read Only)

Returns the date the job was started.

DateTime
status
(Read and Write)

The status name for the job. The statuses available for use are those defined as status types in the Workflow Manager database.

String
versionExists
(Read Only)

Returns True when a version exists for a job.

Boolean
versionName
(Read and Write)

The name of the version for the job.

String

Method Overview

MethodExplanation
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.

Methods

getPendingDays (consider_hold)
ParameterExplanationData Type
consider_hold

Flag to determine whether to consider the holds when calculating the number of pending days.

Boolean

Return Value

Data TypeExplanation
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)
ParameterExplanationData Type
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)
ParameterExplanationData Type
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}")

Code Sample

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
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal