Introduction
- The StickySubagent Instruction can be used to execute a number of jobs with the same Subagent of a JS7 - Agent Cluster. Use of Agent Clusters is subject to the terms for clustering with the JS7 - License.
- Technically the block instruction checks the first available Subagent of a Subagent Cluster. This Subagent will be used for subsequent jobs within the block instruction.
- The underlying use case is a situation when jobs in a workflow create temporary files that should be picked up by successor jobs. If successor jobs were executed with different Subagents on different servers then they might not find files created by predecessor jobs.
- If the Subagent used for the first job of the StickySubagent Instructions becomes unavailable for subsequent jobs then the order will be put to the BLOCKED state. Uses can decide to cancel the order or to make the Subagent available later on. A BLOCKED order will continue execution when the Subagent becomes available.
- Jobs within a StickySubagent Instruction block can be assigned the predetermined Subagent or they can be assigned Standalone Agents and Subagent Clusters unrelated to the StickySubagent Instruction.
FEATURE AVAILABILITY STARTING FROM RELEASE 2.5.0
Workflow Instruction: StickySubagent
Static Assignment of Subagent Cluster
Download example (upload .json): pdfAgentClusterStickySubagent.workflow.json
Using a Subagent Selection to assign the Subagent Cluster to the StickySubagent Instruction
The workflow editor is used to add a StickySubagent Instruction as shown:
- The StickySubagent Instruction is assigned a Subagent Cluster.
- The StickySubagent Instruction includes a number of jobs that should be executed on the same Subagent of the given Subagent Cluster.
Explanation:
- The StickySubagent Instruction is assigned the Subagent Cluster
active-active-all-agents
from theAgentCluster001
cluster. - The jobs inside the StickySubagent Instruction are executed on the same Subagent that is a member of the
active-active-all-agents
Subagent Cluster.- Users are free to exempt individual jobs from using the same Subagent and instead to be executed for example on Standalone Agents.
Using an Agent Cluster for assignment to a Job Instruction
Individual jobs inside the StickySubagent Instruction are assigned Subagents like this:
- The Subagent Expression radio button is selected and the same
AgentCluster001
cluster as for the StickySubagent Instruction is selected. - The Subagent Cluster ID Expression is specified: the
$js7ForkListSubagentId
variable is automatically available at run-time and holds the identification of the respective Subagent for execution of the job.
Dynamic Assignment of Subagent Cluster
The difference between dynamic and static assignment of the intended Subagent Cluster is about the fact that
- static assignment is performed by workflow configuration,
- dynamic assignment is performed by order variables or workflow variables that are created on-the-fly or based on previous job results.
Download example (upload .json): pdfAgentClusterStickySubagentVariable.workflow.json
Using a Workflow Variable to specify the Subagent Cluster
The example introduces two more levels of complexity:
- The Subagent Cluster indicating the Subagents on which to execute jobs in parallel is dynamically specified from a workflow variable.
- The StickySubagent Instruction is combined with a JS7 - Fork-Join Instruction that allows parallel execution of jobs with each Subagent.
Explanation:
- The
subagent_cluster
workflow variable is assigned a default value indicating theactive-active-all-agents
Subagent Cluster.- The default value can be overwritten by an order that specifies this variable.
Using a Subagent Expression to assign the Subagent Cluster to the StickySubagent Instruction
The workflow editor is used to add a StickySubagent Instruction as shown:
- The StickySubagent Instruction is assigned a Subagent Expression.
- This includes to select an Agent Cluster.
- This includes to specify an expression, for this example the workflow variable
$subagent_cluster
, that carries the name of the Subagent Cluster.
- The StickySubagent Instruction includes a number of jobs that should be executed on the same Subagent of the given Subagent Cluster.
Error Handling
The same error handling applies as for the JS7 - ForkList-Join Instruction.
Resources
- JS7 - Fork-Join Instruction
- JS7 - ForkList-Join Instruction
- JS7 - Order State Transitions
- JS7 - How To - Error Handling