# Task

A Task is used to graphically configure and construct image processing devices, tools and operations by placing Task Blocks in a flow diagram.

By default, the blocks are executed serially, from left to right, starting with the block on the left-most side of the Task (1).

The order of execution is based on the position of the upper left corner of the block. Blocks placed in a Parallel Structure will execute in parallel (2). Blocks placed in a Group Region will execute all blocks within the group before executing the next block in the sequence (3, 3A, 3B and 4), or not execute, if a Group Condition Tag is applied (5).

While in Program Mode, to test a Task, press the Task execution buttons, Run All, Run Selected, Run From → End, or Run From → To, in the upper left corner of the Task Editor.

The total Time Taken to execute the Task is reported in the bottom bar below the flow diagram.

Tasks are under the Tasks > Task node of the Project Explorer; double-click the desired Task to open it in the Task Editor.

To test a Task, click the button in the upper left corner of the Task Editor.

Note: As of release 4.0.0, 2.x project sequences are replaced with a sub task.
Note:

- For more information about the Task execution buttons, see the Task Editor topic.

- Best practice is to complete one full run of the task blocks before attempting to run a subset of task blocks.

- You must use the Run All option before using the Run Selected, Run From → End, or Run From → To options if you have used any other component of the In-Sight Multi-Camera IDE prior to using the Task. This will ensure that any Task Block Input and Output pins, as well as tag values, are updated correctly.

- For more information about placement of the blocks in a Task, see Task Block Positioning in the Task Editor topic.

- While in Run Mode, a Task can be configured to execute all of the blocks in the Task, specific blocks or start the order of execution at one block to another specified block. For more information, see the $ Functions: Tasks topic.

- To help define the execution sequence and improve performance, use the Structure Blocks and Regions.

- The total Execution Time reported for the Task will be slightly greater than the sum of all the blocks in the Task (~1ms, depending on the system).

- For keyboard shortcuts and navigation tips, please see the Task Editor Keyboard Shortcuts and Task Editor Navigation topics.

- Tags in a Task are updated as the individual blocks referencing the tags are executed, i.e. tags associated with a Task block, either as an input and/or output, are read and/or written to immediately.

- Since tags are similar to global variables, Cognex advises against configuring a project that allows a tag to be read and/or modified in more than one Task at a time. This can lead to a tag losing updates, depending on when and where the tag was read and/or modified.

- The total Execution Time reported for the Task will be slightly greater than the sum of all the blocks in the Task (~1ms, depending on the system).
- While multiple Tasks can be added to a Task, they will execute in an indeterminate order. Cognex recommends using Sub Task Blocks instead of more than one Task.
- An individual Task within a Task cannot be triggered to execute independent of the other Tasks.
- For keyboard shortcuts and navigation tips, please see Task Editor and its related subtopics.