BPMProcessInstancesCleanup command

Use this command to delete business process definition (BPD) instance data and associated documents for a process application snapshot on IBM® Process Server.

Using this command deletes the BPD instance and its associated tasks and documents for the instances that are specified by the command parameters. It also logs data to a standard SystemOut.log file to track which process applications were selected for deleting instance data and associated documents.

The BPMProcessInstancesCleanup command is run using the AdminTask object of the wsadmin scripting client.
Note: In an environment with multiple security domains configured, use the PALService MBean instead of this wsadmin command. See The Process Application LifeCycle (PAL) MBean.

Prerequisites

The following conditions must be met:
  • Run the command in the connected mode; that is, do not use the wsadmin -conntype none option.
  • You cannot use this command to delete messages for BPEL processes.
  • You can run the command from any cluster member in a network deployment environment. However, you must first establish the wsadmin session to the SOAP port of the cluster member from where you are running the command.
  • To access the wsadmin command, the ID being used must have a WebSphere® Application Server role with more privileges than the monitor role. See Administrative roles for information about roles.
  • To access the IBM BPM API used by this command, the ID being used must belong to either the bpmAdminGroup or bpmAuthorGroup. The default name for the bpmAdminGroup is tw_admins and the default name for the bpmAuthorGroup is tw_authors. See IBM Business Process Manager default group types for information about groups.
    Tip: By default, only the DeAdmin user has both the WebSphere Application Server administrator role and membership in the bpmAdminGroup.

Location

Start the wsadmin scripting client from the install_root/bin directory.

Syntax

BPMProcessInstancesCleanup 
-containerAcronym process_application_acronym
-containerSnapshotAcronym process_application_snapshot_acronym
-instanceStatus instance_status 
[-endedAfterLocal local_time_on_the_server]
[-endedBeforeLocal local_time_on_the_server]
[-instanceID instance_IDs]
[-maximumDuration number_of_minutes]
[-outputFile file_path]
[-transactionSlice number_of_instances_to_delete_in_a_transaction]

Parameters

-containerAcronym process_application_acronym
A required parameter that identifies the acronym that specifies the process application to perform process instance cleanup against. For example, the BillingDispute process application might have an acronym of BILLDISP.
-containerSnapshotAcronym process_application_snapshot_acronym
A required parameter that identifies the snapshot acronym for the process application. The snapshot acronym can be different from the snapshot name. To find the snapshot acronym, run the BPMShowProcessApplication command. Refer to the topic in the related link.
-instanceStatus instance_status
A required parameter that identifies the status of process instances to clean up.
  • COMPLETED - Removes all completed process instances
  • FAILED - Removes all failed process instances
  • CANCELED - Removes all terminated process instances
  • ALL - Removes all completed, failed, and canceled process instances
Tip: You cannot delete an instance that is currently running.
-endedAfterLocal local_time_on_the_server
An optional parameter of type String that identifies the local time on the server. The string must have the following format:yyyy-MM-ddThh:mm:ss (year, month, day, T, hours, minutes, seconds). Only instances that completed, failed, or canceled after the specified time period by this parameter are processed. If you use this parameter with the endedBeforeLocal parameter, only instances that completed, failed, or canceled during the specified time period by this parameter are processed.
-endedBeforeLocal local_time_on_the_server
An optional parameter of type String that identifies the local time on the server. The string must have the following format: yyyy-MM-ddThh:mm:ss (year, month, day, T, hours, minutes, seconds). Only instances that completed, failed, or canceled before the specified time period are processed. If you use this parameter with the endedAfterLocal parameter, only instances that completed, failed, or canceled during the specified time period by this parameter are processed.
-instanceID instance_IDs
An optional parameter of type String[] that identifies a list of instance IDs that are being removed. If there is more than one instance ID, each instance ID must be delimited by a space for Jython format commands or a semicolon for JACL format commands. You can also use this parameter with endedAfterLocal or endedBeforeLocal. See the examples in this topic.
-maximumDuration number_of_minutes
An optional parameter that specifies the maximum deletion time in minutes. If the cleanup takes longer than the time specified here, the current transaction slice for the current cleanup job is completed, and then the current cleanup job is stopped. The default is 0 (that is, no limit) if not specified.
-outputFile file_path
An optional parameter that specifies the file path to write the log messages that result from running the command. The path to the file can be absolute or relative but the directory structure must already exist. If you do not provide this parameter, the message are written to the SystemOut.log file.
-transactionSlice number_of_instances_to_delete_in_a_transaction
An optional parameter that specifies the number of instances in the transaction for the delete operation. The default value is 1 if not specified.

You should check the SystemOut.log file for exceptions if the cleanup service adjusted your transactionSlice. Adjusting the number of instances to be deleted in a transaction can improve the cleanup operation time.

Examples

The following examples show how to use the BPMProcessInstancesCleanup command.

Important: In a network deployment environment, use the port configured for the application cluster member that runs the Process Server or IBM Process Center applications. To determine the correct port number, see the administrative console Ports collection page (click Servers > Server Types > WebSphere application servers > server_name > Communications > Ports and find the value for SOAP_CONNECTOR_ADDRESS).
  • Deleting the BPD instance and its associated tasks for the instances
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym PA435 -containerSnapshotAcronym V1 -instanceStatus FAILED -outputFile C:\US58626\log1.txt]')
     
  • Deleting instances based that are based on instance IDs
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -instanceID [4 5 1001 1002]]') 
    
  • Deleting instances that occur during a time range that falls within a specific range
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedAfterLocal 2012-01-01T00:00:00 -endedBeforeLocal 2012-02-31T21:37:06]') 
    
  • Deleting instances that occur before the specified local time on the server
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedBeforeLocal 2012-01-02T21:37:06]') 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedBeforeLocal 2012-05-02]') 
    
  • Deleting instances that occur after the specified local time on the server
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedAfterLocal 2012-05-31T21:38:00]') 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedAfterLocal 2012-07-31]') 
    
  • Deleting specific instances that occur on a specific time range and are based on instance IDs
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedAfterLocal 2012-01-01T00:00:00 -endedBeforeLocal 2012-02-31T21:37:06 -instanceID [53 54 55]]') 
    
  • Deleting instances that occur before and after the specified local time on the server and are based on instance IDs
    wsadmin -conntype SOAP -port 8880 -host ProcessServer01.mycompany.com -user admin -password admin -lang jython 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedAfterLocal 2012-05-20T00:00:00 -instanceID [53 54 55 56 57 58]]') 
    
    wsadmin>AdminTask.BPMProcessInstancesCleanup('[-containerAcronym BILLDISP -containerSnapshotAcronym SS2.0.1 -instanceStatus ALL -endedBeforeLocal 2012-05-31T21:37:06 -instanceID [53 54 55 56 57 58]]')