NAME
Process::SubProcess::Group - Module to manage and run multiple Sub Processes at once
DESCRIPTION
Process::SubProcess::Group
implements a class to manage multiple Sub Process and run them at once while keeping their Output and Errors related to each command.
The Idea of this API is to launch Sub Processes and keep track of all Output on STDOUT
, STDERR
, the EXIT CODE
and possible System Errors at Launch Time in an object oriented manner.
METHODS
Constructor
- new ( [ CONFIGURATIONS ] )
-
This is the constructor for a new SubProcess.
Parameters:
CONFIGURATIONS
are passed in a hash like fashion, using key and value pairs.Recognized Configurations:
check
- Time in seconds when to check a process for new output. This is calculated based on the count of processes to manage.read | readtimeout
- Time in seconds to wait for the process output. If the process is expected to run longer it is useful to set it to avoid excessive checks. It is also important for multiple process execusions, because other processes will not be checked before the read has not timed out.timeout
- Time in seconds to wait for the process to finish. After this time the process will be terminateddebug
- show internal processing informationquiet
- do not print any warnings or errors
Administration Methods
- add ( [ OBJECT | CLASS ] )
-
This method adds a Process object to the list of managed processes.
Parameters:
OBJECT | CLASS
- is aProcess::SubProcess
object or a compatible class name. If a class name or no parameter is given a new object will be created.Returns: It returns the object that was addded to list. If an object was given the same will be returned.
- setCheckInterval ( INTERVAL )
-
This method calculates the
READTIMEOUT
for eachProcess::SubProcess
object according to the amount of existing objects. The value of theREADTIMEOUT
for each Process will be rounded to a whole number.Example:
The Process Group manages 3 Processes. Processes "A", "B" and "C". Process "A" should be checked every 6 seconds. So, setting
setCheckInterval(6)
will set theREADTIMEOUT
of Processes "A", "B" and "C" to 2 seconds. This way after cycling over the processes the Process "A" will be checked again after 6 seconds.Parameters:
INTERVAL
- is an integer that specifies the interval in which all processes should be checked once.
- setReadTimeout ( TIMEOUT )
-
This method set the
READTIMEOUT
for eachProcess::SubProcess
object.Parameters:
TIMEOUT
- is an integer that specifies the time in seconds to wait for output from the command for eachProcess::SubProcess
object.
- setTimeout ( TIMEOUT )
-
This method set the
EXECUTIONTIMEOUT
for theProcess::SubProcess::Group
object.This enables the EXECUTIONTIMEOUT functionality in the
Wait()
method which ensures that no process runs longer than required. TheWait()
method will call theTerminate()
method which will call theTerminate()
method on eachProcess::SubProcess
that is still running.Parameters:
TIMEOUT
- is an integer that specifies the maximal execution time in seconds of the whole Process Group execution.See Method
Wait()
- Wait ( [ CONFIGURATIONS ] )
-
This method checks the
Process::SubProcess
objects regularly and continues until allProcess::SubProcess
objects report that they are notRUNNING
anymore.If the EXECUTIONTIMEOUT functionality is enabled the method will call the
Terminate()
method which then calls theTerminate()
method on eachProcess::SubProcess
that is still running.Parameters:
CONFIGURATIONS
- is a list are passed in a hash like fashion, using key and value pairs.Recognized Configurations:
check
- is an integer that specifies the interval in which all processes should be checked once.read | readtimeout
- is an integer that specifies the time in seconds to wait for output from the command for eachProcess::SubProcess
object.timeout
- is an integer that specifies the maximal execution time in seconds of the whole Process Group execution.