FastSurferCNN.utils.run_tools

class FastSurferCNN.utils.run_tools.MessageBuffer(out=b'', err=b'', retcode=None, runtime=0.0)[source]

MessageBuffer class.

Attributes

retcode

Methods

err_str

out_str

class FastSurferCNN.utils.run_tools.Popen(*args, **kwargs)[source]

Extension of subprocess.Popen for convenience.

Attributes

universal_newlines

Methods

as_future(pool[, timeout])

Similar to finish in its application, but as non-blocking Future.

communicate([input, timeout])

Interact with process: Send data to stdin and close it.

finish([timeout])

finish's behavior is similar to subprocess.dry_run.

kill()

Kill the process with SIGKILL

poll()

Check if child process has terminated.

send_signal(sig)

Send a signal to the process.

terminate()

Terminate the process with SIGTERM

wait([timeout])

Wait for child process to terminate; returns self.returncode.

async_finish

messages

next_message

as_future(pool, timeout=None)[source]

Similar to finish in its application, but as non-blocking Future.

Parameters:
poolExecutor

A concurrent.futures.Executor, usually a ThreadPoolExecutor.

Returns:
Future[MessageBuffer]

A Future object which will contain the result.

See also

finish

The finish method provides similar functionality.

finish(timeout=None)[source]

finish’s behavior is similar to subprocess.dry_run.

finish waits timeout seconds, and forces termination after. By default, waits unlimited timeout=None. In either case, all messages in stdout and stderr pipes are read and together with the return code in a MessageBuffer object.

Parameters:
timeoutfloat, optional

Seconds to wait before forcing termination.

Returns:
MessageBuffer

A MessageBuffer object with the content of the stdout and stderr pipes.

class FastSurferCNN.utils.run_tools.PyPopen(args, *_args, **kwargs)[source]

Attributes

universal_newlines

Methods

as_future(pool[, timeout])

Similar to finish in its application, but as non-blocking Future.

communicate([input, timeout])

Interact with process: Send data to stdin and close it.

finish([timeout])

finish's behavior is similar to subprocess.dry_run.

kill()

Kill the process with SIGKILL

poll()

Check if child process has terminated.

send_signal(sig)

Send a signal to the process.

terminate()

Terminate the process with SIGTERM

wait([timeout])

Wait for child process to terminate; returns self.returncode.

async_finish

messages

next_message