Skip To Content

Set Next Task

Summary

Sets the next task in a workflow from the task list.

Caution:

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

Caution:

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

Usage

  • A task is a small, focused unit of work that can be executed by an individual. Task groups are composed of multiple tasks that, when executed in sequence, complete a type of work. For example, a task group to perform 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 administrator as part of configuring the Topographic Mapping workflows.

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

  • The Set Task List tool must be run before this tool to ensure that the appropriate tasks are associated with the job. Based on the list of tasks associated with the job, this tool determines the next task to be executed.

  • This tool uses the order and status of the tasks associated with the job to determine the next task. If a task is found, the current task extended property will be set with the ID of the task with the lowest task order that is in Waiting status. If all tasks have been completed and none remain in the task list, the current task will be set to 0.

Syntax

SetNextTask_topographic (job_id, {database_path})
ParameterExplanationData Type
job_id

The ID of the Workflow Manager job that will be updated.

Long
database_path
(Optional)

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

File

Derived Output

NameExplanationData Type
updated_job_id

The Job ID of the updated Workflow Manager job.

Long

Code sample

SetNextTask example (stand-alone script)

This script takes the next task with a status of 1 and sets it as the next task for the parent job.

# Name: SetNextTask_sample.py
# Description: This script will take the next task with a status of 1 and set it as the next task for the parent job

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('foundation')

# Setting the environment
arcpy.env.overwriteOutput = True

# Setting Local Variables
job_id = 2072
input_database_connection = r'C:\Data\Workflows\Testing.jtc'

# Calling the Set Next Task to update the TOPO_TASK_GROUP_PROPERTIES table and to set the next job
arcpy.topographic.SetNextTask(job_id, 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')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Requires Production Mapping
  • Advanced: Requires Production Mapping

Related topics