This topic applies only to the IBM Business Process Manager Advanced configuration.

deleteCompletedProcessInstances.py administrative script

Use the deleteCompletedProcessInstances.py administrative script to selectively delete from the Business Process Choreographer database any top-level process instances that have reached an end state of finished, terminated, expired, or failed.

Prerequisites

The following conditions must be met:
  • Run the script in the connected mode, that is, do not use the wsadmin -conntype none option.
  • At least one cluster member must be running.
  • Include the wsadmin -user and -password options to specify a user ID that has operator authority.
  • If you are not working with the default profile, use the wsadmin -profileName profile option to specify the profile.

Location

The deleteCompletedProcessInstances.py administrative script is in the Business Process Choreographer admin directory.
For Windows operating systeminstall_root\ProcessChoreographer\admin
For Linux operating systemFor UNIX operating systeminstall_root/ProcessChoreographer/admin

Syntax

-f deleteCompletedProcessInstances.py 
  -cluster cluster_name
  (-all | [-finished] [-terminated] [-failed] )
  [-templateName templateName 
  [-validFromUTC timestamp]]
  [-startedBy userID]
  [(-completedAfterLocal timestamp)|(-completedAfterUTC timestamp)]
  [(-completedBeforeLocal timestamp)|(-completedBeforeUTC timestamp)]

Parameters

-f
This parameter specifies the script file to run.
-cluster clusterName
The name of the cluster where Business Process Choreographer is configured. In a multicluster setup, you must specify the application cluster because that is where Business Process Choreographer is configured.
-all | -terminated | -failed | -expired | -finished
Specifies which task instances are to be deleted according to their state. The -all option means all end states: finished, terminated, failed, and expired. If you do not specify -all, you must specify one or more of the end states.
-templateName templateName
Optionally, specifies the name of the task template whose instances will be deleted. If you specify this option, you must also specify the nameSpace parameter. If there are multiple task templates with the same name but with different validFromUTC dates the instances for all task templates with that name are deleted unless you use the validFromUTC parameter to specify a particular template.
-validFromUTC timestamp
The date and time from which the template is valid in Coordinated Universal Time (UTC). The string must have the following format: yyyy-MM-ddThh:mm:ss (year, month, day, T, hours, minutes, seconds). For example, 2005-01-31T13:40:50
-startedBy userID
Optionally, only deletes completed process instances that were started by the given User ID.
-completedAfterLocal timestamp
Optionally, specifies that only instances that completed after the given local time on the server are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you specify only a date, the time defaults to 00:00:00 local time on the server.
-completedAfterUTC timestamp
Optionally, specifies that only instances that completed after the UTC time are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you specify only a date, the time defaults to 00:00:00 local time on the server.
-completedBeforeLocal timestamp
Optionally, specifies that only instances that completed before the given local time on the server are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you specify only a date, the time defaults to 00:00:00 local time on the server.
-completedBeforeUTC timestamp
Optionally, specifies that only instances that completed before the given UTC time are deleted. The format for the timestamp string is the same as for -validFromUTC, except that the time part is optional for this parameter. If you specify only a date, the time defaults to 00:00:00 local time on the server.

Examples

For example, to delete all of the process instances that are running on cluster myCluster that are in the state finished, and were started by the user Anita:

For Linux operating systemFor UNIX operating systemEnter the following command:

wsadmin.sh -f deleteCompletedProcessInstances.py 
        -cluster myCluster 
        -finished
        -startedBy Anita

For Windows operating systemEnter the following command:

wsadmin -f deleteCompletedProcessInstances.py 
        -cluster myCluster 
        -finished
        -startedBy Anita