ogstools.logparser.log_parser module#

ogstools.logparser.log_parser.parallel_log_used(file_name)[source]#

Counts the number of MPI processes started by OpenGeoSys-6 by detecting specific log entries in a given file.

Parameters:

file_name (str | Path) – The path to the log file, as either a string or a Path object.

Return type:

int

Returns:

An integer representing the estimated number of MPI processes based on the log file’s content.

ogstools.logparser.log_parser.read_mpi_processes(file_name)[source]#

Reads the number of MPI processes started by OpenGeoSys-6 from the log file.

Parameters:

file_name (str | Path) – The path to the log file, as either a string or a Path object.

Return type:

int | None

Returns:

An integer representing the number of MPI processes. Or if serial execution: None

ogstools.logparser.log_parser.normalize_regex(ogs_res, parallel_log=False)[source]#

Takes regex patterns for serial computation and modify them for parallel Parallel log lines are prepended with the process id, e.g. [0] or [1]

Return type:

list

ogstools.logparser.log_parser.simple_consumer(queue)[source]#
Return type:

None

ogstools.logparser.log_parser.parse_line(patterns, line, parallel_log, number_of_lines_read)[source]#
Return type:

Log | Termination | None

ogstools.logparser.log_parser.read_version(file)[source]#

Read the version of the OGS log file.

Parameters:

file (Path) – Path to the OGS log file.

Return type:

int

Returns:

The version number as an integer.

ogstools.logparser.log_parser.parse_file(file_name, maximum_lines=None)[source]#

Parses a log file from OGS, applying regex patterns to extract specific information,

The function supports processing files in serial or parallel mode. In parallel mode, a specific regex is used to match log entries from different processes.

Parameters:
  • file_name (str | Path) – The path to the log file, as a string or Path object.

  • maximum_lines (int | None) – Optional maximum number of lines to read from the file. If not provided, the whole file is read.

Return type:

list[Any]

Returns:

A list of extracted records based on the applied regex patterns. The exact type and structure of these records depend on the regex patterns and their associated processing functions.

ogstools.logparser.log_parser.select_regex(version)[source]#
Return type:

list[tuple[str, type[Log]]]