Auto Resume Settings
- Last UpdatedJul 24, 2024
- 7 minute read
The Workflow Engine, a windows service, is responsible for workflow execution and routing of activities. Workflow instances and the activities within the workflow are assigned different status values based on the execution state. These status values are persisted in the database.
This section highlights the various methods available to resume specific workflow instances.
List of Workflow Status Values
Following is the list of status values which are assigned to the workflows during execution:
|
Status |
Description |
|---|---|
|
EP |
Execution Pending This status is assigned to a workflow, when the workflow execution has not begun. |
|
EX |
Execution in Progress This status is assigned to a workflow, if any one of the workflow activity starts its execution. |
|
SL |
Sleep Mode The workflow is in Sleep mode when all the pending activities are in sleep mode. |
|
FN |
Finished Successfully The Workflow Execution is considered to be complete, if all the activities have completed execution. |
|
FE |
Workflow Execution Finished with Errors If any activity has an error while execution, the workflow stops with this status. |
|
AB |
Aborted This status is assigned to a workflow, when it gets aborted while execution. |
|
PA |
Paused This status is assigned to a workflow, when it is paused while execution. |
Following is the list of status values assigned to the activities during runtime:
|
Status |
Description |
|---|---|
|
P |
Execution Pending |
|
E |
Activity Executing |
|
S |
Sleep |
|
C |
Execution Completed |
|
Z |
Next action initiated |
|
K |
Activity killed |
|
U |
Activity paused |
What happens when a workflow fails to execute?
When an activity within a workflow instance fails, the workflow instance is marked as Finished with Errors (FE) and the activity is marked as executing (E).
When can a workflow fail and finish with errors?
Following are some of the possible reasons for a workflow to fail:
-
An activity in the workflow fails, which in turn can happen due to:
-
Invalid configuration settings for the activity properties
-
Uninitialized variable being used in the activity
-
Slow network connectivity
-
-
Slow network connectivity to the database server
How can a workflow be modified and resumed?
If a workflow fails due to invalid configuration settings or due to improper use of variables, you can modify the workflow accordingly and then republish it.
For example, consider a workflow which has finished with errors as shown in the image given below. The activity Estimate due time has failed to execute. The user can check AVEVA Work Tasks log files or event viewer to identify the reason of failure. The workflow can then be modified accordingly, and then republished.
Different methods to resume workflow instances
-
Using AVEVA Work Tasks APIs
-
Using BAM reports
-
Using the Auto Resume Feature
Using AVEVA Work Tasks API
AVEVA Work Tasks APIs can be used to resume workflow instances in FE state.
Given below is the sample code:
-
Namespace: Workflow.NET.Engine
-
Assembly: Workflow.NET.NET2.dll.
static void ResumeWorkflowWithErrors(int executionId, string application, string workflow)
{
Client client = null;
try
{
client = new Client(application, workflow);
if (client.CanResumeWorkflowWithErrors(executionId))
client.ResumeWorkflowWithErrors(executionId);
}
catch (Exception exp)
{
Console.Write(exp.ToString());
}
finally
{
if(client != null)
client.Close();
client = null;
}
}
Ensure that the client object is closed in the final block.
To use BAM Reports
Follow the steps given below to resume FE workflow instances from BAM reports:
-
In the Enterprise Console, navigate to Reports.
The AVEVA Work Tasks Business Activity Monitoring page appears.
The tree view on the left side gets loaded with reports for different workflow instances.
-
Click Failed node available under Analyze > Execution.
A report of all the workflow instances that have finished with errors appears.
-
Double-click on any of the workflow instance.
The workflow progress view pop up window appears. The left side of the pop up window has icons to pause, abort, resume paused workflows, and to resume FE workflows.
-
Click the icon to resume workflow finished with errors.
This would resume the activity which has failed to execute and the workflow would progress to the next state.
Automatically resuming from Workflow Engine
The workflow instances that have pending events or are in EP or FE state can be automatically resumed using the Auto Resume Feature. By default all the repositories that are configured in the farm are considered for resuming the workflow instances.
Auto Resume Settings
The Auto Resume Settings tab of the AVEVA Work Tasks Engine Settings is used to configure properties for automatically resuming workflow instances that have pending events or are in FE or EP state.
The following properties are applicable to all three types of workflow instances (FE, EP, Pending Workflow Events):
|
Field |
Description |
|---|---|
|
Select Repositories |
All the repositories that are mapped to the current farm are listed here. The user can either select the Select All check-box to resume workflow instances from all the repositories or select the required repositories from the list. |
|
Resume workflow instances with FE/EP status from |
Select a date which would be considered by the Workflow Engine while fetching the workflow instances. From the selected date onwards, all the workflow instances that have pending events or are in EP or FE status will be resumed automatically. This date selected here is compared with the LastUpdatedDateTime field from SWExecute table. |
|
Enable logging of auto resume messages |
It enables you to control the log messages in the logger console whenever the engine tries to resume the respective workflow instances. |
FE Workflow Instances
The details of failed workflow instances that are automatically resumed by the Workflow Engine are stored in the SWFECount table. This table keeps track of the execution IDs of workflows that have finished with errors (FE) and the number of retries that engine has made to re-execute the failed workflow. After resuming the workflow, if the workflow executes successfully then the corresponding record is deleted from the SWFECount table. If the workflow instance is still in FE state even after the set number of retries, then an exception is emailed to the Admin configured in the To Email property in the farm configuration settings.
Configurations for Resuming FE Workflows
Given below is the list of properties that needs to be configured for resuming FE workflows:
|
Field |
Description |
|---|---|
|
Number of retries to resume FE workflow instances |
The number of attempts that the Workflow Engine should make to resume the FE workflow instances. For example, if this value is set to 5 then the Workflow Engine would make 5 attempts to resume each of the FE workflow instance. If this value is set to 0 (zero) then, then auto resume of FE workflow instances does not occur. |
|
Remove resume history when FE workflow instances are completed |
If the value is selected as True, the history of resumed FE workflow instances which have completed successfully would be deleted from the SWFECOUNT table. If the value is selected as False, the history of resumed FE workflow instances which have completed successfully would be retained in the SWFECOUNT table. |
|
Time interval to fetch FE workflow instances |
It is used to set the time interval for resuming FE workflow instances. The value entered should be greater than 5 minutes. |
|
No. of FE workflow instances to be fetched in the specified time interval |
It is used set the number of workflow instances to be fetched for auto resume in the specified time interval. |
EP Workflow Instances
Given below is the list of properties that needs to be configured to resume EP workflows:
|
Field |
Description |
|---|---|
|
Enable auto resume of EP workflow instances |
This property is used to enable or disable auto resume of EP workflow instances. Note: The Enable auto resume setting does not apply to the scheduled workflows. |
|
Fetch workflow instances which have been in EP state for |
This property is used to set the minimum time for which the workflow instances should have been in EP state. The value should be entered in days.hr:min:sec format. If this value is set as 5, the Workflow Engine tries to fetch the workflow instances which have been in EP state for at least 5 hours. The Workflow Engine calculates the time for which the workflow instances have been in EP state by comparing the LastUpdatedDateTime value from SWExecute table with the current time. The default time for which workflow instances have been in EP state is 5 hours. If the time set is less than 5 hours, then by default, the Engine considers 5 hours as the minimum time. |
|
Time interval to fetch EP workflow instances |
It is used to set the time interval for resuming EP workflow instances. Minimum value should be greater than 5 minutes. |
|
No. of EP workflow instances to be fetched in the specified time interval |
It is used set the number of EP workflow instances to be fetched for auto resume in the specified time interval. |
Pending Workflow Events
Given below is the list of properties that needs to be configured for resuming Pending Workflow Events.
|
Field |
Description |
|---|---|
|
Enable auto resume of pending workflow events |
This property is used to enable or disable auto resume of pending workflow events. Note: The Enable auto resume setting does not apply to the scheduled workflows. |
|
Minimum time for which the workflow events are in Pending state |
This property is used to set the minimum time for which the workflow events should be in Pending state. If this value is set as 0.5:0:0, the workflow engine will fetch the events which are in Pending state for at least 5 hours. The workflow engine calculates the time for which the workflow events have been pending by comparing the LastUpdatedDateTime value from SWExecute table with the current time. The default time for which workflow events should be in pending state is 5 hours. If the time set is less than 5 hours, then by default, the engine considers 5 hours as the minimum time. |
|
Time interval to fetch workflow instances with pending events |
It is used to set the time interval for resuming workflow instances with pending events. Minimum value should be greater than 5 minutes. |
|
No. of workflow instances with pending events to be fetched in the specified time interval |
It is used set the number of workflow instances with pending events to be fetched for auto resume in the specified time interval. |