BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Mon March 29, 2021 02:03 PM
    The snapshots I want to delete have no instances running anymore, have no dependents and are inactive. But when I try to delete I'm having the error message:
    "java.lang.Exception: java.lang.Exception: You cannot delete a snapshot that is referenced by tasks belonging to BPD instances referencing another snapshot"

    What does it mean? The only reason I can imagine is that once upon the time there were activities created with that snapshot that were later migrated.
    Actually, I have deleted any old failed instance, and I've terminated all running instances. So at this moment, there are no active instances.
    What maybe the reason why I cannot delete the snapshots?

    Look at the output of the following commands to demonstrate that there are no obvious dependencies preventing the deletion:

    wsadmin> print AdminTask.BPMShowProcessApplication('[-containerAcronym RMT001]')
    
    Name: Gestion de Expediente
    Acronym: RMT001
    Description:
    Toolkit: false
    Tracks:
    
           List of Snapshots:
                    Name: V2.1
                    Acronym: V2.1
                    Created On: 2021-03-24 20:45:46.633
                    Created By: User.9
                    Is Default: false
                    State: State[Inactive]
                    Capability: Capability[Standard]
                    No of running instances: 0
    
                    Name: V6.2
                    Acronym: V6.2
                    Created On: 2021-03-29 17:38:17.5
                    Created By: User.9
                    Is Default: true
                    State: State[Active]
                    Capability: Capability[Standard]
                    No of running instances: 0
    	 ...
    
    wsadmin>print AdminTask.BPMShowSnapshot('[-containerAcronym RMT001 -containerSnapshotAcronym V2.1 -showDependents]')
    
    Name: V2.1
    Acronym: V2.1
    Created On: 2021-03-24 20:45:46.633
    Created By: User.9
    Is Default: false
    State: State[Inactive]
    Capability: Capability[Standard]
    Theme: Carbon
    No of running instances: 0
    
    wsadmin>AdminTask.BPMDeleteSnapshot('[-containerAcronym RMT001 -containerSnapshotAcronyms [V2.1])
    
    WASX7015E: Excepción al ejecutar el mandato: "AdminTask.BPMDeleteSnapshot('[-containerAcronym RMT001 -containerSnapshotAcronyms [V2.1]]')"; información de excepción:
    java.lang.Exception: java.lang.Exception: You cannot delete a snapshot that is referenced by tasks belonging to BPD instances referencing another snapshot
    





    ------------------------------
    Eduardo Izquierdo Lázaro
    ------------------------------


  • 2.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Mon March 29, 2021 10:45 PM
    Please see the prerequisites here 
    https://www.ibm.com/support/knowledgecenter/SS8JB4_19.x/com.ibm.wbpm.ref.doc/topics/rref_deletesnapshot.html

    ------------------------------
    Atanu Roy
    ------------------------------



  • 3.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Tue March 30, 2021 04:36 AM

    I checked all the prerequisites before. Please check the output of the commands that I posted above.

    • The snapshot must exist - OK
    • The snapshot must be inactive - OK
    • The snapshot must have no running instances - OK
    • The snapshot must not be deployed – OK (this is for advanced content only, but anyway I run the stop and undeploy command as well)
    • In an Advanced deployment environment, any business-level applications that are related to the snapshot must be uninstalled before you can delete the snapshot. - Don't Apply

     Can you be more specific?, what prerequisites are you talking about?

    I really don't understand the exception : "You cannot delete a snapshot that is referenced by tasks belonging to BPD instances referencing another snapshot"

    Which tasks if there are no running instances?

    Thanks.

    ------------------------------
    Eduardo Izquierdo Lázaro
    ------------------------------



  • 4.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Tue March 30, 2021 09:54 AM
    You need to clean up closed tasks from the snapshot which were not migrated during instance migration.
    Try to clean the tasks up using BPMTasksCleanup and then try to delete the snapshot.


    ------------------------------
    Atanu Roy
    ------------------------------



  • 5.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Tue March 30, 2021 01:09 PM
    Ok thanks Atanu, your solution works

    Because I have no way to know which tasks are the problematic ones, I cleaned up all COMPLETED Tasks in the snapshots and then It can deleted.

    I still cannot understand, because all the instances were migrated to the latest snaphot (as you can see in the output of the commands above). It's true that left some orphan instances during the migration, but I deleted manually all of them.

    However, there is something scaring: after BPMTaskCleanup and BPMDeleteSnapshot a lot of instances dissapeared in Process Inspector.
    So "completed task cleanup" does it means deleting the completed instances? So the data is lost for Process & Team performance dashboards of Process Portal? and what about the tracking group values reported by those Tasks in PDW?

    Thanks again



    ------------------------------
    Eduardo Izquierdo Lázaro
    Automation Architect
    DECIDE
    MADRID
    +34609893677
    ------------------------------



  • 6.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Wed March 31, 2021 06:43 PM
    Edited by Thong Huynh Wed March 31, 2021 06:44 PM
      |   view attached
    Hi Eduardo,

    "You cannot delete a snapshot that is referenced by tasks belonging to BPD instances referencing another snapshot"

    Yes, I shared your confusion. Neither do I understand why BPM's still relating to any task data even after everything's been migrated to the latest snapshot. 

    I would not recommend you to run BPMTasksCleanup because it will delete completed tasks in your live instances which you may not want until you are sure to completely delete the instances on process server. Rather, you should run BPMProcessInstancePurge

    Try the Purge command and retry BPMDeleteSnapshot. 

    Effectively, I've derived a script to completely purge your process server. Please do the following steps in your Test environment to test it out:

    Py script to delete snapshots, save this in a dir such as: D:\scripts\deleteSnapshot.py

    ---

    import re

    # function delete unused snapshots in the process server

    def deleteSnapshots(projectName):

     allSnapshotsString = AdminTask.BPMShowProcessApplication('[-containerAcronym ' + projectName + ']')

     allSnapshots = re.findall(r'\n\t\tAcronym: (.*?)\n\t\tCreated On(.*?)\n\t\tState', allSnapshotsString)

     for x in range(len(allSnapshots)):

      acronym = allSnapshots[x][0]  

      searchForDefaultTrue = re.search(r'Is Default: true', allSnapshots[x][1])

      isDefault = str(searchForDefaultTrue) != 'None'

      if (isDefault == 1):

        print(acronym + ' is default, skipping it')

      else:

    paramsString = '[-containerAcronym ' + projectName + ' -containerSnapshotAcronyms [ ' + acronym + ' ]]'

    print('Deleting snapshot: ' + acronym)

    AdminTask.BPMDeleteSnapshot(paramsString)

     return 'done'

    ---

    Script to purge your PS

    Remove Terminated Instance: AdminTask.BPMProcessInstancesPurge('[-containerAcronym BTM -instanceStatus TERMINATED]')

    Remove Completed Instance: AdminTask.BPMProcessInstancesPurge('[-containerAcronym BTM -instanceStatus COMPLETED]')

    Execute py script: 

    wsadmin>execfile('D:\scripts\deleteSnapshots.py')

    wsadmin>deleteSnapshots("Project_Acronym")

    Of course, you can include BPMProcessInstancesPurge into the py script. Then you can purge your entire server with one command :)
    Let me know if this works for you

    Regards




    ------------------------------
    Thong Huynh
    Sydney NSW
    ------------------------------

    Attachment(s)

    py
    deleteSnapshots (1).py   797 B 1 version


  • 7.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Tue April 06, 2021 03:52 AM
    Hi Thong, many thanks for the script. 

    Yes I agree is very confusing that after the migration of instances there is no a clear state.
    Each instance should be referencing ONLY to its current snapshot, specially because there is no way to know in which snapshot it was executed, so you cannot do a proper cleanup deleting only the "dirty" tasks without loosing other information in the history of executions.

    Now I have loosed the instances, but next time I will try your script, looks promising. I will give you feedback.

    Regards.

    ------------------------------
    Eduardo Izquierdo Lázaro
    Automation Architect
    DECIDE
    MADRID
    +34609893677
    ------------------------------



  • 8.  RE: Why I can't delete old unused snapshots installed in ProcessServer?

    Posted Fri April 16, 2021 08:33 AM
    Now I realized why my instances were not properly migrated and become orphans instances that caused me this loose of completed instances in PRO.
    There is a bug in the doc, if you copy the command to migrate instances directly from page https://www.ibm.com/docs/en/baw/20.x?topic=server-using-wsadmin-commands-custom-installation-packages it is incorrect, it's missing the -orphanTokenPolicyFile paremter before the migration policy file

    AdminTask.BPMMigrateInstances('[-containerAcronym HSS -sourceContainerSnapshotAcronym V1 -targetContainerSnapshotAcronym V2 C:\logFiles\V1_to_SHSV856.xml]')
    If you don't realize about that, there is no exception or warning at all, the instances are migrated but the policy file is ignored causing orphans instances.
    Don't know if there is a better place to report this type of issues, so I posted here just in case.

    ------------------------------
    Eduardo Izquierdo Lázaro
    Automation Architect
    DECIDE
    MADRID
    +34609893677
    ------------------------------