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.
- exception valjean.eponine.tripoli4.parse.ParserException[source]
An error that may be raised by the
Parserclass.
- class valjean.eponine.tripoli4.parse.Parser(jddname)[source]
Scan Tripoli-4 listings, then parse the required batches.
- __init__(jddname)[source]
Initialize the
Parserobject.- Parameters:
jddname (str) – path to the Tripoli-4 output
It also initalizes the result of
scan.ScannertoNone, 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 fromcollections.abc.Mappingvarious default methods are available likelen,[], etc. The keys ofScannerare the batch numbers available from the Tripoli-4 output. To get their list, usebatch_numbers.
Parsing (e.g.
parse_from_number) returns aParseResult.
- 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:
- 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:
- 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 checkedif the listing name contains
"exploit"or"verif", it is most probably an exploitation job (Green bands for example),"exploitation time"is checkedelse
"simulation time"is checked
- 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
ParseResultobject 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 fromScanneror fromParser. 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
resdictionary in aBrowserthanks to the methodto_browser.- __init__(parse_res, scan_vars, name='')[source]
Initialize the
ParseResultfrom:- Parameters:
Fill the res object.
- to_browser()[source]
Get a
Browserfrom theParseResult.The global variables in Browser are the batch data. You can access the run data only from the parsed result.
- Return type: