Job

Résumé

The Job object provides access to properties and methods to interact with a Workflow Manager (Classic) 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 datasets, or no data at all. A Job is created based on 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.

Propriétés

PropriétéExplicationType de données
assignedTo
(Lecture/écriture)

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

String
assignedType
(Lecture/écriture)

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.

  • UserA user in the workflow database
  • GroupA group in the workflow database
  • UnassignedNo job assignment
String
createdBy
(Lecture/écriture)

The user name of the user who created the job.

String
createdDate
(Lecture seule)

Returns the date the job was created.

DateTime
currentSteps
(Lecture seule)

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

List
description
(Lecture/écriture)

The description of the job.

String
dueDate
(Lecture/écriture)

The date the job was scheduled to end.

DateTime
endDate
(Lecture seule)

Returns the date the job ended.

DateTime
hasAOI
(Lecture seule)

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

Héritage :

This method has been deprecated. Use hasLOI instead.

Boolean
hasLOI
(Lecture seule)

Returns True when the job has a location of interest (point or polygon) defined.

Boolean
ID
(Lecture seule)

Returns the job ID.

Integer
jobTypeID
(Lecture seule)

Gets the ID of the job type for the job.

Integer
name
(Lecture/écriture)

The job's name.

String
notes
(Lecture/écriture)

The notes associated with the job to share information with other users.

String
owner
(Lecture/écriture)

The user name of the user who owns the job.

String
parent
(Lecture/écriture)

The ID of the parent job for the current job.

Integer
parentVersion
(Lecture/écriture)

The name of the parent version of the job.

String
percentComplete
(Lecture seule)

Returns the percent completion for the job.

Double
priority
(Lecture/écriture)

The priority of the job.

Integer
startDate
(Lecture/écriture)

The date the job was scheduled to start.

DateTime
startedDate
(Lecture seule)

Returns the date the job was started.

DateTime
status
(Lecture/écriture)

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

String
versionExists
(Lecture seule)

Returns True when a version exists for a job.

Boolean
versionName
(Lecture/écriture)

The name of the version for the job.

String

Vue d’ensemble des méthodes

MéthodeExplication
addAttachment (storage_type, source_location)

Adds an attachment to the job.

addDependency (depends_on_job_id, {held_on_type}, {held_on_value}, {dependent_on_type}, {dependent_on_value})

Adds a dependency to a job to restrict progression of the job past a certain point until another job has progressed past a given point.

addHold (hold_type_id, {comment})

Adds a hold to a job to suspend job activity.

deleteAttachment (attachment_id)

Deletes an attachment associated with the job.

deleteJobMap ()

Deletes the job map associated with the job.

executeStep ({step_id}, {callback})

Executes a step in the workflow.

getAttachments ()

Returns all attachments associated with the job as a list of Attachment objects.

getExtendedPropertyTable (tableName)

Returns a single extended property table based on its fully qualified table name.

getHolds ()

Returns the holds associated with the job as a list of Hold objects.

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.

getWorkflow (jobID)

Returns a job's Workflow using the job ID.

listExtendedProperties ()

Lists the fully qualified name of all extended property and linked property tables associated with the job.

logActivity (activity_type, {message})

Logs an activity in the job history to describe an action on the job.

markStepAsComplete ({step_id}, {callback})

Marks a step in the workflow as complete.

releaseHold (hold, {comment})

Releases the hold associated with a job and marks it as an inactive hold.

retrieveAttachment (attachment_id, destination_location)

Retrieves the file attachments associated with the job to a location on disk.

retrieveJobMap (destination_location)

Retrieves the job map to a location on disk.

save ()

Saves any changes made to the job back to the Workflow Manager (Classic) database.

sendNotification (notification_type)

Sends a notification based on an event in the job life cycle.

setAOI (aoi)

Sets the area of interest (AOI) polygon for the job.

Héritage :

This method has been deprecated. Use setLOI instead.

setDataWorkspace (data_workspace_id)

Sets the data workspace for the job.

setLOI (loi)

Sets the location of interest (LOI) for the job. The LOI can be either a point (POI) or polygon (AOI).

setStepAsCurrent (step_id)

Sets a step in the workflow as the current active step.

storeJobMap (source_location)

Saves a map in the Workflow Manager (Classic) database and associates it to the job as the job map to be used for editing.

Méthodes

addAttachment (storage_type, source_location)
ParamètreExplicationType de données
storage_type

The type of attachment to be added.

  • EMBEDDEDThe file is stored in the Workflow Manager (Classic) database.
  • LINKEDThe link to the file path is stored in the Workflow Manager (Classic) database.
  • URLThe URL link is stored in the database.
String
source_location

The file path or URL for the attachment to be added.

String

The attachments provide a way to add information to the job. The following types of attachments can be added to a job:

  • Embedded—The file is stored in the Workflow Manager (Classic) database.
  • Linked—The link to the file path is stored in the Workflow Manager (Classic) database.
  • URL—The URL link is stored in the database.

The following script adds a linked, embedded, and URL attachment to the job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Add a linked file attachment
job.addAttachment('LINKED',r'c:\test\Requirements.doc')

#Add an embedded file attachment
job.addAttachment('EMBEDDED',r'c:\test\Field_Observation.png')

#Add url attachment
job.addAttachment('URL','http://www.esri.com')
addDependency (depends_on_job_id, {held_on_type}, {held_on_value}, {dependent_on_type}, {dependent_on_value})
ParamètreExplicationType de données
depends_on_job_id

ID of the job on which the current job will depend.

Integer
held_on_type

Indicates whether the current job (to which the dependency is being added) will be held at a step or status. When the job is held at a step, the step cannot be executed until the dependency is released. When the job is held at a status, the job's status cannot change until the dependency is released. The dependency is released when the other job reaches the step or status as defined in the dependency criteria.

(La valeur par défaut est STEP)

String
held_on_value

The value of the step or status at which the current job will be held. This value can be the ID of a step as an integer or job status as a string.

Variant
dependent_on_type

Indicates whether the current job (to which the dependency is being added) will be dependent on a step or status of the other job. When the dependent job is held at a step or status of the other job, the dependent job cannot progress until the other job reaches the step or status defined in the dependency. Once the other job reaches step or status as defined in the dependency criteria the dependency is released and the dependent job can progress.

(La valeur par défaut est STATUS)

String
dependent_on_value

The value of the step or status of the other job on which the current job will be dependent. This value can be the ID of a step as an integer or job status as a string.

(La valeur par défaut est CLOSED)

Variant

Job dependencies allow you to model relationships between jobs, allowing you to restrict progress of a job until another job has progressed past a certain point. Restrictions can be placed on the following parts of a job: Status or Step.

When the job that is restricting the workflow of another reaches the point defined in the dependency, the restricted job is automatically released and is able to work.

The following script adds the default dependency, a job step to status dependency and a job status to step dependency on the current job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Add a dependency to job 99999 that holds it at the current step, until the status of job 55555 is Closed
job.addDependency(55555)

#Add a dependency to job 99999 that holds it at step 5, until the status of job 88888 is Working
job.addDependency(88888,'STEP',5,'STATUS','WORKING')

#Add a dependency to job 99999 that holds it at status QAQC, until step 8 of job 77777 is active.
job.addDependency(77777,'STATUS','QAQC','STEP',8)
addHold (hold_type_id, {comment})
ParamètreExplicationType de données
hold_type_id

The ID of the hold type template to be used to create the job hold.

Integer
comment

The comment to be stored as a reason for adding the hold.

String

Holds suspend the job activity for an indefinite amount of time until it is released. A hold can be applied to a job for reasons including the following:

  • Insufficient funding
  • Technical problems
  • Missing data
  • Lack of resources

The following script gets the hold types in the Workflow Manager (Classic) database and adds a budget hold to a job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get a list of Hold types in Workflow database
hold_types = conn.config.getHoldTypes()

#Access a Workflow Job 
job = conn.getJob(99999)

#Find the id of Budget Hold hold type and add a hold on the job
for hold in hold_types:
     if(hold.name=='Budget Hold'):
         job.addHold(hold.id,comment="Insufficient funds for digitization.")
deleteAttachment (attachment_id)
ParamètreExplicationType de données
attachment_id

The ID of the attachment to be deleted.

Integer

The attachments provide a way to add information to the job.

The following script deletes an attachment from the job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Delete attachment with id = 1
job.deleteAttachment(1)
deleteJobMap ()

The job map has the layers used for editing required as part of the job.

The following script deletes the job map of a job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Delete the job map of the job
job.deleteJobMap()
executeStep ({step_id}, {callback})
ParamètreExplicationType de données
step_id

The ID of the step to be executed. The step ID is optional; if a step ID is not provided, the current step will be executed.

Integer
callback

The callback argument 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
Valeur renvoyée
Type de donnéesExplication
WorkflowExecutionResult

Returns a WorkflowExecutionResult object, which stores the step's return code.

Provides a way to execute a step in the workflow.

The following script executes a step in the workflow and provides an example of a callback function that can be used during execution.

import arcpy, sys, traceback

#Define the callback response function. In this case it will prompt the user using the console to respond.
def callback(question, responses):

    # Print out the expected responses
    for resp in responses:
        print("[%i] %s" % (resp[1], resp[0]))
		
    # Prompt the user to respond
    val = int(input("%s - %s: " % (question[1], question[0])))
	
    # Return their response. Currently only returning the value, but could also return a note (for questions) and the name of the response
    return (val, "", "")

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get a Job for Execution
job = conn.getJob(77601)

try:
	#Execute the current Step in the workflow
	result = job.executeStep(callback=callback)
    
	print ("Executing the first step returned %i" % result.returnCode)
	
	#Run the next Step in the workflow
        result = job.executeStep(callback=callback) 
    
	#Mark the step as complete
	job.markStepAsComplete(callback=callback) 

#Raised when a step in the workflow encounters an execution error	
except wmx.WorkflowExecutionStepError as e:
    print ("Step failed to execute:")
    print("-"*60)
    traceback.print_exc()
	
#Raised when a workflow encounters an execution error
except wmx.WorkflowExecutionError as f:
    print ("Workflow failed to execute:")
    print("-"*60)
    traceback.print_exc()
getAttachments ()
Valeur renvoyée
Type de donnéesExplication
Attachment

The attachments associated with the job are returned as a list of Attachment objects.

The attachments provide a way to add information to the job. The following types of attachments can be added to a job:

  • Embedded—The file is stored in the Workflow Manager (Classic) database.
  • Linked—The link to the file path is stored in the Workflow Manager (Classic) database.
  • URL—The URL link is stored in the database.

The following script gets the attachments associated with the job and prints the names of linked attachments.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Get the list attachments associated with the job
attachments = job.getAttachments()

#Print the names of Linked file attachments associated with the job
for attach in attachments:
     if(attach.type=='Linked'):
         print(attach.name)
getExtendedPropertyTable (tableName)
ParamètreExplicationType de données
tableName

The fully qualified table name of the extended property table to be returned.

String
Valeur renvoyée
Type de donnéesExplication
ExtendedProperty

Returns the extended property table as the ExtendedProperty object.

The business-specific information stored as part of the job as extended properties are returned as the ExtendedProperty object.

The following script gets an extended property table associated with the job and prints the name of the cells along with the value.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job with extended properties
job = conn.getJob(99999)

#Get the extended properties table associated with the job
prop_table = job.getExtendedPropertyTable('wmx.extra_properties')

#Iterate over extended properties and print the cell name with values
for (name,value) in prop_table:
    print("Cell {0} = {1}" .format(name,value.data))
getHolds ()
Valeur renvoyée
Type de donnéesExplication
Hold

The job holds returned as a list of Hold objects.

Holds suspend the job activity for an indefinite amount of time until it is released. A hold may be applied to a job for reasons including the following:

  • Insufficient funding
  • Technical problems
  • Missing data
  • Lack of resources
The information about a Hold is never deleted from the system and can be queried.

The following example prints the names of Active Holds on the job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Print the Active Holds on the job
jobHolds = job.getHolds()
for hold in jobHolds:
        if(hold.active==True):
            print("Active Hold = {0}" .format(hold.type))
getPendingDays (consider_hold)
ParamètreExplicationType de données
consider_hold

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

Boolean
Valeur renvoyée
Type de donnéesExplication
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

#Establish a connection to a Workflow database
conn = arcpy.wmx.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))
getWorkflow (jobID)
ParamètreExplicationType de données
jobID

The ID of the job.

Integer
Valeur renvoyée
Type de donnéesExplication
Object

Returns the workflow as a Workflow object.

Provides an easy way to retrieve a job's workflow.

Get the workflow of a job from the Workflow Manager (Classic) database.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Job
job = conn.getJob(99999)

#Access a the job's workflow
workflow = job.getWorkflow()

#Print the name of the workflow
print(workflow.name)
listExtendedProperties ()
Valeur renvoyée
Type de donnéesExplication
String

List of fully qualified names of all extended property and linked property tables associated with the job.

The names of tables that store business-specific information with the job as extended properties and linked properties can be retrieved.

The following script lists the fully qualified name of all the extended property and linked property tables associated with the job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpywmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job with extended properties
job = conn.getJob(99999)

#List all the extended property tables and linked property tables associated with the job
job.listExtendedProperties()
logActivity (activity_type, {message})
ParamètreExplicationType de données
activity_type

The ID or the name of an ActivityType.

String
message

The custom message to be appended to the existing message in the ActivityType.

String

The Job history contains a log of everything that has happened throughout the life of the job. Each of the items in the log are time stamped with the time of entry and stamped with the current user at that time. A message is also stored along with the record, explaining what happened at that point in time.

The following example logs a custom activity with a message to an existing job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Change the assignment of the job to Editors group
job.assignedType='Group'
job.assignedTo='Editors'

job.save()

#Log an activity for the reassignment of the job
job.logActivity('AssignJob','Job assigned to Editors group.')
markStepAsComplete ({step_id}, {callback})
ParamètreExplicationType de données
step_id

The ID of the step to be marked as complete. The step ID is optional; if a step ID is not provided, the current step will be executed.

Integer
callback

The callback argument passes a function that prompts the user for a response based on input from the step type. When marking a question step complete, 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

Provides a way to mark a step as complete.

The following script marks a step in the workflow complete and provides an example of a callback function that can be used during execution.

import arcpy, sys, traceback

#Define the callback response function. In this case it will prompt the user using the console to respond.
def callback(question, responses):

    # Print out the expected responses
    for resp in responses:
        print("[%i] %s" % (resp[1], resp[0]))
		
    # Prompt the user to respond
    val = int(input("%s - %s: " % (question[1], question[0])))
	
    # Return their response. Currently only returning the value, but could also return a note (for questions) and the name of the response
    return (val, "", "")

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Get a Job for Execution
job = conn.getJob(77601)

try:
	#Execute the current Step in the workflow
	result = job.executeStep(callback=callback)
    
	print ("Executing the first step returned %i" % result.returnCode)
	
	#Run the next Step in the workflow
        result = job.executeStep(callback=callback) 
    
	#Mark the step as complete
	job.markStepAsComplete(callback=callback) 

#Raised when a step in the workflow encounters an execution error	
except wmx.WorkflowExecutionStepError as e:
    print ("Step failed to execute:")
    print("-"*60)
    traceback.print_exc()
	
#Raised when a workflow encounters an execution error
except wmx.WorkflowExecutionError as f:
    print ("Workflow failed to execute:")
    print("-"*60)
    traceback.print_exc()
releaseHold (hold, {comment})
ParamètreExplicationType de données
hold

The hold to be released provided as a Hold object.

Hold
comment

The comment to be stored as a reason for releasing the hold.

String

The hold suspends the job activity for an indefinite amount of time until it is released. Once a hold is released, the information about it is never deleted from the system and can be queried.

The following script releases active budget holds associated with the job.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Release the active Budget Holds on the job
jobHolds = job.getHolds()
for hold in jobHolds:
        if(hold.active==True and hold.type=='Budget Hold'):
            job.releaseHold(hold,comment='Budget has been approved. The job work can resume')
retrieveAttachment (attachment_id, destination_location)
ParamètreExplicationType de données
attachment_id

The ID of the attachment to be retrieved.

Integer
destination_location

The folder location where the attachment will be stored. A name for the file to be saved with or without the file extension can also be provided. If no name is provided, the attachment is saved with the default name stored with the job.

String

The attachments provide a way to add information to the job. The following types of attachments can be retrieved from a job:

  • Embedded—The file is stored in the Workflow Manager (Classic) database.
  • Linked—The link to the file path is stored in the Workflow Manager (Classic) database. It can be retrieved only if you have access to the file path.

The following script retrieves job attachments to a folder location.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Get the list attachments associated with the job
attachments = job.getAttachments()

#Print the names of Linked file attachments associated with the job
for attach in attachments:
     if(attach.type=='Linked'):
         print(attach.name)
retrieveJobMap (destination_location)
ParamètreExplicationType de données
destination_location

The folder location where the job map will be stored. A name for the map to be saved can also be provided. If no name is provided the job map is saved with the default naming scheme defined for the job map.

String

The job map has the layers used for editing required as part of the job.

The following script retrieves the job to a disk location.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Retrieve the job map and save to C:\Test 
job.retrieveJobMap(destination_location=r'C:\Test')
save ()

The following script saves an updated job assignment.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.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()
sendNotification (notification_type)
ParamètreExplicationType de données
notification_type

The name of the notification type template to be used to send the email notification associated with the job.

String

Email notification can be triggered during the life cycle of a job to provide information about an event related to the job. Examples of sending notifications include the following:

  • Job assigned or reassigned
  • Job created
  • Job closed

The following example reassigns a job and sends an email notification about it.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Reassign the job to a user
job.assignedTo='amiller'

#Send an email notification for the job assignment
job.sendNotification(notification_type='JobAssigned')
setAOI (aoi)
ParamètreExplicationType de données
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

#Establish a connection to a Workflow database
conn = arcpy.wmx.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)
ParamètreExplicationType de données
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

#Establish a connection to a Workflow database
conn = arcpy.wmx.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}")
setLOI (loi)
ParamètreExplicationType de données
loi

The point or polygon to be assigned as the location of interest for the job.

Geometry

Defines the location of interest for a job. To get a job's location of interest, use the Get Job AOItool.

The following script includes sample code to define a single point or multipoint geometry and set it as the job's location of interest.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job
job = conn.getJob(99999)

# 1. Set the job's location of interest to single point geometry

# Create single point geometry

point = arcpy.Point(-119.5,35.9)
loi_1 = arcpy.PointGeometry(point)

job.setLOI(loi_1)
job.save()


#2. Set the job's location of interest to multipoint geometry

job = conn.getJob(10000)

# Create multipoint 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])
loi_2 = arcpy.Multipoint(array)

job.setLOI(loi_2)
job.save()
setStepAsCurrent (step_id)
ParamètreExplicationType de données
step_id

The ID of the step to be set as the current step.

Integer

Provides a way to set a step in the workflow as the current active step.

The following script sets a step in the workflow as current.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job
job = conn.getJob(99999)

#Set a step as current in the Job
job.setStepAsCurrent(2315)
storeJobMap (source_location)
ParamètreExplicationType de données
source_location

The file path that has the map to be stored in the Workflow Manager (Classic) database.

String

The job map has the layers used for editing required as part of the job.

The following script saves the job map in the Workflow Manager (Classic) database.

import arcpy

#Establish a connection to a Workflow database
conn = arcpy.wmx.Connect(r'c:\test\Workflow.jtc')

#Access a Workflow Job 
job = conn.getJob(99999)

#Store the job map in Workflow database 
job.storeJobMap(source_location=r'C:\Test\JobMap_17.mapx')

Exemple de code

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

#Establish a connection to a Workflow database
conn = arcpy.wmx.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.versionExists == True:
    jobversion = job.versionName
    print("The job's data workspace is " + jobversion)