Package Products :: Package ZenUtils :: Module ProcessQueue :: Class ProcessQueue |
[hide private]
[frames] | no frames]

# Class ProcessQueue

source code

    object --+
             |
            ProcessQueue

Ansynchronously run processes. Processes are queued up and run in a FIFO order. Processes are run in concurrently up to the configured amount.

Instance Methods | [hide private]
__init__(self, parallel=10) initialize the process queue; process in queue will not executed until start is called. | source code
queueProcess(self, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None, processProtocol=None, timeout=60, timeout_callback=None) add a process to the queue. | source code
stop(self) stops the process queue; no more processes will be accepted. | source code
start(self) start processing the queue. | source code
_processQueue(self) | source code

Method Details | [hide private]

### __init__(self, parallel=10) (Constructor) | source code
initialize the process queue; process in queue will not executed until start is called. Parameters: `parallel` (int) - number of process to run concurrently Overrides: object.__init__

### queueProcess(self, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None, processProtocol=None, timeout=60, timeout_callback=None) | source code
add a process to the queue. args are similar to reactor.spawnProcess Parameters: `processProtocol` (ProcessProtocol from twisted) - optional protocol to control the process `timeout` (int) - how many seconds to let the process execute `timeout_callback` (callable w/ one arg) - callable to call if the process times out Raises: `QueueStopped` - if the queue has been stopped

### stop(self) | source code
stops the process queue; no more processes will be accepted. deferred will be called back when process queue is empty

### start(self) | source code
start processing the queue. Processes will only be executed when the reactor starts