ProcessOutputReader

class ase2sprkkr.common.process_output_reader.ProcessOutputReader(print_output=False, read_callback=None)[source]

Class, that run a process, optionally saves all the output of the process to a file, and pass the stdout and stderr of the process to its two async routines, read_error and read_output.

The descendant can redefine the routines to parse the output (or its parts).

Class hierarchy

Inheritance diagram of ase2sprkkr.common.process_output_reader.ProcessOutputReader

Constructor

__init__(print_output=False, read_callback=None)[source]
stop_the_process()[source]
_kill()[source]
async run_subprocess(read_args=[])[source]
result(output, error, wait)[source]

This function is for postprocessing the results.

It is intended to be predefined in the descendants

Parameters:
  • output (mixed) – Result of the self.read_output

  • error (mixed) – Result of the self.read_error

  • wait (int) – The process return value

Returns:

out – Currently, the tuple (output, error, return_code) is returned, however, subclasses can return anything they want.

Return type:

mixed

run_async(cmd, outfile, directory=None, read_args=[], **kwargs)[source]
_run(cmd, outfile, directory=None, read_args=[], **kwargs)[source]
async read_error(stderr, *args)[source]
async read_output(stdout, *args)[source]
set_print_output(print_output)[source]
read_from_file(cls, output, error=None, read_args=[], return_code=0)[source]

Synchronous wrapper for reading output/error from files.

async read_output_file(output, error=None, read_args=[], return_code=0)[source]

Async version: reads output and error from files using AsyncioFileReader.