deleteCompletedTaskInstances.py administrative script
Use the deleteCompletedTaskInstances.py administrative script to selectively delete from the Business Process Choreographer database any top-level task instances that have reached an end state of finished, terminated, expired, or failed.
Sometimes follow-on task instances form a chain of follow-on tasks; where all but the last task instance are in the forwarded state and the last task instance in the chain is in some other state. In this case, a top-level task instance that is in the forwarded state is considered to be completed if the last task instance in the chain is in one of the following end states: finished, terminated, expired, or failed.
Normally, an inline task instance is not considered to be a top-level task instance, and cannot be deleted using the deleteCompletedTaskInstances.py script because the inline task instance belongs to a BPEL process, which means you must use deleteCompletedProcessInstances.py to delete the completed process instance that the inline task belongs to. However, any inline invocation task instance that was created using the Human Task Manager API or the Service Component Architecture (SCA) API is treated as a top-level task instance, and can be deleted using the deleteCompletedTaskInstances.py script.
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
install_root\ProcessChoreographer\admin
install_root/ProcessChoreographer/admin
Syntax
-f deleteCompletedTaskInstances.py
-cluster clusterName
(-all | [-finished] [-terminated] [-failed] [-expired] )
[-templateName templateName -nameSpace nameSpace
[-validFromUTC timestamp]]
[-createdBy 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
- The name of the template to be deleted.
- -nameSpace nameSpace
- Optionally, specifies the namespace of the task template to be deleted. If you specify this option, you must also specify the templateName 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
- -createdBy userID
- Optionally, deletes only completed task instances that were created 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.
Example
For example, to delete the task instances on cluster myCluster that are in the finished state, and were created by the user Erich:Enter the following command:
wsadmin.sh -f deleteCompletedTaskInstances.py
-cluster myCluster
-finished
-createdBy Erich
Enter the following command:
wsadmin -f deleteCompletedTaskInstances.py
-cluster myCluster
-finished
-createdBy Erich
If
Business Process Choreographer is configured on the cluster, the tasks will be deleted from the
Business Process Choreographer runtime database. If Business Process Archive Manager is configured
on the cluster, the same command will delete the specified tasks from the archive database
associated with the Business Process Archive Manager. Be careful not to delete any instances from a
runtime database that should actually be moved to an archive.