Set Task Status (Topographic Production)

摘要

Updates the status of a task based on the state of the Workflow Manager (Classic) job created for the task.

警告:

This tool is designed to be run as a step in a Workflow Manager (Classic) workflow. Running this tool outside of Workflow Manager (Classic) does not honor all Workflow Manager (Classic) constraints such as job assignment, dependencies, or holds and may cause a job to enter an unusable state.

警告:

This tool is intended for use with the Topographic Mapping production workflows and will not support an improperly configured Workflow Manager (Classic) repository. Sample workflows and instructions for configuring Topographic Mapping production workflows are available as part of the product file installer.

提示:

It is recommended that current Workflow Manager (Classic) users begin new projects using the services-driven version of ArcGIS Workflow Manager for ArcGIS Pro.

使用情况

  • A task is a small, focused unit of work that can be processed by an individual. Task groups are composed of multiple tasks that, when processed in sequence, complete a type of work. For example, a task group that performs data extraction can be composed of tasks to collect data, validate the data, and publish the data. Task groups and their associated tasks are defined by your Workflow Manager (Classic) administrator as part of configuring the topographic mapping workflows.

  • When run through Workflow Manager (Classic), a parent job is created for a task group to define the type of work to be completed over a specific area of interest. When a task is ready to be run, a job is created for the task and is linked to the task group job as a child.

  • The Set Task List and Create Job For Task tools must be run before this tool to ensure that the appropriate tasks are associated with the job and a job has been correctly created for the task.

  • Tasks have one of the following five statuses:

    • 1: Waiting—A task is identified as work that needs to be done but is waiting for the appropriate conditions to be met before a job will be created for the task. When a task is added using the Set Task List or Insert Task Group tools, the status is set to 1. If a corresponding task job needs to be ran from the start, this tool can also set the status to 1 by setting the Status parameter value to Restart. This can be helpful when a task job encounters an issue and must be restarted.
    • 2: Ready to Work—A job has been created for this task, but work has not yet begun. The Create Job For Task tool sets the status to 2.
    • 5: Working—Work has started on the task job. This tool can be used to set the status of a job to working.
    • 10: Complete—The task job has been successfully completed. This tool can be used to set the status of a job to complete.
    • 20: Cancelled—The task job has been cancelled. The Cancel Remaining Tasks tool is used to cancel remaining tasks for a job and sets the status for remaining tasks to 20.

  • In addition to setting a working status, this tool records information about when the task job started and who is running the job.

  • In addition to setting a complete status, this tool records information about when the task completed. The difference between the date and time the task was set to working and when it was set to complete is used to calculate the task duration and percent complete for the parent task group job.

  • The status of each task is assessed by the Set Next Task and Insert Task Group tools to determine the appropriate next steps. Failure to correctly set the status of each task may cause unexpected results from these tools.

参数

标注说明数据类型
Job ID

The job ID of the task job that has a change in status.

Long
Parent Job ID

The job ID of the task group job that is the parent to the task job.

Long
Status

Specifies the status of the selected task.

  • WorkingWork has begun for the task.
  • CompleteWork has been completed for the task.
  • RestartWork will be restarted by creating a new job of the same type.
String
Input Database Path
(可选)

The Workflow Manager (Classic) database connection file that contains the job information. If no connection file is specified, the current default Workflow Manager (Classic) database will be used.

File

派生输出

标注说明数据类型
Updated Job ID

The job ID of the updated Workflow Manager (Classic) job.

Long

arcpy.topographic.SetTaskStatus(job_id, parent_id, status, {database_path})
名称说明数据类型
job_id

The job ID of the task job that has a change in status.

Long
parent_id

The job ID of the task group job that is the parent to the task job.

Long
status

Specifies the status of the selected task.

  • WORKINGWork has begun for the task.
  • COMPLETEWork has been completed for the task.
  • RESTARTWork will be restarted by creating a new job of the same type.
String
database_path
(可选)

The Workflow Manager (Classic) database connection file that contains the job information. If no connection file is specified, the current default Workflow Manager (Classic) database will be used.

File

派生输出

名称说明数据类型
updated_job_id

The job ID of the updated Workflow Manager (Classic) job.

Long

代码示例

SetTaskStatus example (stand-alone script)

This script uses the SetTaskStatus function to set the status of a task in the TOPO_TASK_PROPERTIES table to complete.

# Name: SetTaskStatus_sample.py
# Description: This script will set the status of a task in the TOPO_TASK_PROPERTIES table to complete

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')
arcpy.CheckOutExtension('JTX')

# Setting the environment
arcpy.env.overwriteOutput = True

# Setting Local Variables
job_id = 6506
parent_id = 6506
status = "COMPLETE"
input_database_connection = r'C:\Data\Workflows\Testing.jtc'

# Calling the Set Task Status tool to update the TOPO_TASK_PROPERTIES table and update the status of the current task
arcpy.topographic.SetTaskStatus(job_id, parent_id, status, input_database_connection)

# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))

# Check In Extensions
arcpy.CheckInExtension('Foundation')
arcpy.CheckInExtension('JTX')

环境

此工具不使用任何地理处理环境。

许可信息

  • Basic: 否
  • Standard: 需要 Production Mapping and Workflow Manager
  • Advanced: 需要 Production Mapping and Workflow Manager

相关主题