parse – Parse Tripoli-4 outputs

Module performing scanning and parsing of Tripoli-4 outputs.

This module also allows quick checks on outputs:

  • presence of "NORMAL COMPLETION"

  • presence and values of times (simulation, exploitation)

Some options for debugging are available (end flag).

Todo

Change absolute imports in relative ones when main will be moved to cambronne.

valjean.eponine.tripoli4.parse.profile(fprof)[source]

To profile memory usage.

exception valjean.eponine.tripoli4.parse.ParserException[source]

An error that may be raised by the Parser class.

class valjean.eponine.tripoli4.parse.Parser(jddname)[source]

Scan Tripoli-4 listings, then parse the required batches.

__init__(jddname)[source]

Initialize the Parser object.

Parameters:

jddname (str) – path to the Tripoli-4 output

It also initalizes the result of scan.Scanner to None, then executes the scan. If this step fails an exception is raised.

The Parser main object instance variable is:

scan_res (Scanner)

result from the scan of the Tripoli-4 output. See in the related documentation the various instance variables available (like times). Inheriting from collections.abc.Mapping various default methods are available like len, [], etc. The keys of Scanner are the batch numbers available from the Tripoli-4 output. To get their list, use batch_numbers.

Parsing (e.g. parse_from_number) returns a ParseResult.

batch_numbers()[source]

Help method to get the available batch numbers.

Return type:

list(int)

parse_from_number(batch_number, name='')[source]

Parse from batch index or batch number.

Parameters:

batch_number (int) – number of the batch to parse

Return type:

ParseResult

parse_from_index(batch_index=- 1, name='')[source]

Parse from batch index or batch number.

Per default the last batch is parsed (index = -1).

Parameters:

batch_index (int) – index of the batch in the list of batches

Return type:

ParseResult

print_stats()[source]

Print Tripoli-4 statistics (warnings and errors).

check_times()[source]

Check if running times are well written in Tripoli-4 listings. These times are at the end of the result block and mark the end flag.

Returns:

boolean, True if well present, else False

Returned bool depends on the listing:

  • if the job was run in parallel mode (and declared so), "simulation time" and "elapsed time" should be present in that order, only the second one is checked

  • if the listing name contains "exploit" or "verif", it is most probably an exploitation job (Green bands for example), "exploitation time" is checked

  • else "simulation time" is checked

print_times()[source]

Print time characteristics of the Tripoli-4 result considered. This print includes initialization time, simulation time, exploitation time and elapsed time.

class valjean.eponine.tripoli4.parse.ParseResult(parse_res, scan_vars, name='')[source]

Class containing a parsing result from Tripoli-4 output for one batch.

The ParseResult object is accessible from the instance attribute

res

that is a unique dictionary containing all the results from scanning and parsing steps. Variables characteristic to a batch are stored under the key 'batch_data' no matter if they come from Scanner or from Parser. Variables characteristic to a run (= one execution of Tripoli-4) are stored under 'run_data', coming from the scanning step.

It is possible to transform the res dictionary in a Browser thanks to the method to_browser.

__init__(parse_res, scan_vars, name='')[source]

Initialize the ParseResult from:

Parameters:
  • parse_res (dict) – result from T4 parsing (for 1 batch)

  • scan_vars (dict) – variables coming from Scanner global to job or specific to the batch.

  • name (str) – name to give to the parse result (will be propagated to data)

Fill the res object.

to_browser()[source]

Get a Browser from the ParseResult.

The global variables in Browser are the batch data. You can access the run data only from the parsed result.

Return type:

Browser