vcProcessManager

The process manager service automatically creates, updates and removes process groups (vcProcessGroup) when process implementations (vcProcessRoutine) are added, renamed or removed within its parent process controller. The process groups can be used to easily find all implementations of a process.

Process implementations are owned by vcProcessExecutor instances.

Properties

Name Type Access Description
Controller vcProcessController R Gets the process controller owner.
ProcessGroups List of vcProcessGroup R Gets a list of all current processes in this process controller.

Methods

Name Return Type Parameters Description
findProcessGroup vcProcessGroup

String processId

Tries to find a process group that contains all processes with the given id.

Returns None if no such processes exist.

changeGroupId

None

vcProcessGroup group,

String newId

Tries to rename a process i.e. change id of all process implementations in a process group. This can fail non-trivially if some process executor already contains a process with the new id.

Either the rename succeeds fully or no changes are made, throws an exception if the operation didn’t succeed.

Events

Name Parameters Description
OnProcessAdded

vcProcessRoutine process,

vcProcessGroup group

Triggered when a new process implementation has been added.

OnProcessRemoving

vcProcessRoutine process,

vcProcessGroup group

Triggered when a process implementation is about to be removed.

OnGroupIdChanged

vcProcessGroup group,

String previousId

Triggered when all processes within a group changed their id. The usual case is when the group only contains a single process implementation and its id gets changed.

Examples

Example. Get the event when adding/removing/changing name of a process routine from the process manager

from vcScript import *
#Get process manager in the component
comp = getComponent()
process_executor = comp.findBehavioursByType('rProcessExecutor')[0]
process_controller = process_executor.ProcessController
process_manager = process_controller.ProcessManager
#Get the list of all process groups that belongs to this process manager
process_groups = process_manager.ProcessGroups
#print process_groups
'''
#Find the process group and change the name
process_old = process_manager.findProcessGroup("Process #1")
process_manager.changeGroupId(process_old, "Process New")
'''
#Get event when adding a process routine to the process manager
def ProcessAdded(routine, group):
  print "Process Group - {} is added to {}::{}".format(routine.Name, comp.Name, process_executor.Name)
#Get event when removing a process routine to the process manager
def ProcessRemoved(routine, group):
  print "Process Group - {} is removed from, {}::{}".format(routine.Name, comp.Name, process_executor.Name)
process_manager.OnProcessAdded = ProcessAdded
process_manager.OnProcessRemoving = ProcessRemoved