Package Ganga :: Package Utility :: Package AMGAServerTools :: Module Commands :: Class Command
[hide private]
[frames] | no frames]

Class Command

source code

Class to submit a command to the operative system

Instance Methods [hide private]
 
__init__(self, cmd, std_in=None, timeout=30, pipesize=0, blocksize=1024, capturestderr=False)
cmd = command to be executed.
source code
 
__del__(self) source code
 
submit(self)
Legacy method.
source code
 
getInput(self)
Return list of input strings.
source code
 
getStatus(self) source code
 
isRunning(self)
Shows is command running or not.
source code
 
_readlines(self, output) source code
 
readOutput(self, pipe_ind, maxblocks=0, timeout=None)
Read no more than maxblocks from out pipe i.
source code
 
finalize(self)
Tries to kill command process, close pipes and stop threads.
source code
 
getOutput(maxblocks=...)
--> [std_out and std_err lines],...
source code
 
getStatusOutput(self, maxblocks=0)
getStatusOutput([maxblocks]) --> (status, getOutput())
source code
Method Details [hide private]

__init__(self, cmd, std_in=None, timeout=30, pipesize=0, blocksize=1024, capturestderr=False)
(Constructor)

source code 

cmd       = command to be executed.
std_in    = input for the command.
timeout   = timeout between blocks of the command output (in seconds).
pipesize  = the size (in blocks) of the queue used to buffer
            the blocks read.
blocksize = the maximum block size for a raw read.
capturestderr if True tells to merge std_out and std_err of the command.

submit(self)

source code 

Legacy method. Deprecated.

isRunning(self)

source code 

Shows is command running or not. If there is no way to establish this (win32 without extensions) always returns True.

readOutput(self, pipe_ind, maxblocks=0, timeout=None)

source code 

Read no more than maxblocks from out pipe i. i = 0 std_out (or std_out + std_err) i = 1 std_err. If maxblocks = 0 (default) read till the end of data or timeout between blocks arrival

finalize(self)

source code 

Tries to kill command process, close pipes and stop threads. Can block on win32 without win extensions.

getOutput(maxblocks=...)

source code 
--> [std_out and std_err lines],
    if capturestderr = True
--> ([std_out lines], [std_err lines]),
    if capturestderr = False