Setting the Agent Group for Workflows

As a developer and object designer, when you define Jobs you assign them the Agent or Agent Group on which they should be processed. When you assemble your Workflows, you connect Jobs because their outputs affect each other. For example, one Job creates or modifies a file on the Agent that the next Job in the Workflow needs. In such cases, both Jobs must run on the same Agent. Otherwise the second one would not be able to access the file that results from the first one. To ensure that this happens, you have two options:

  • Assign the same Agent to both Jobs.
  • Assign the same Agent Group to both Jobs and activate the Assign same Agent option in the Workflow in which they run.

This is what happens when you activate this checkbox:

  1. When the first task starts (that is, when it is generated), one of the Agents in the group is assigned for processing it. This is a standard Workflow behavior.
  2. The Workflow stores the Agent Group and the Agent that has been assigned to this task.
  3. When the next task that uses the same Agent Group starts, the Workflow retrieves this information and assigns the same Agent to it.

Storing the Agent and Agent Group information in the top Workflow ensures that all its tasks use the same Agent. It also ensure that the Agent is calculated only once. Embedded Workflows and their tasks also use the same Agent as the parent Workflow.

Important! In case of Workflows within Workflows, this setting must be activated in the parent.

Re-using Agent Group calculation is not possible in:

  • Tasks that start on behalf of a group.
  • Tasks that are defined in a Workflow task's properties.
  • The PREP_PROCESS_AGENTGROUP script element in the script of a Workflow or of the tasks that are included in a Workflow.

Example

The following graphics illustrate how this function works. In this example, the Assign same Agent checkbox is activated in two Workflows (Workflow1 and Workflow2).

The first task of the Workflow (Job1) is processed first. Job1 uses Agent group 1. Agent1 is selected because there are no internal entries for a former Agent Group calculation.

Later, AgentGroup1 and the corresponding Agent1 are stored in the Workflow.

Graphic that illustrates the behavior o the first job in the Workflow

Workflow2 is a child of the top Workflow (Workflow1). Its task Job3 re-uses AgentGroup1. When Job3 starts, Agent1 (which has already been stored in the top Workflow) is selected for the execution.

Graphic that illustrates the behavior o the third job in the Workflow

Therefore, all tasks of the same Agent Group use the same Agent regardless of their subordination level.

See also: