qb :: backend :: logParser :: LogParser :: Class LogParser
[hide private]
[frames] | no frames]

Class LogParser

source code


The base class for log parsers in Qube, it provides all the functionality needed with the exception of calculating in-frame progress.

Since calculating in-frame progress requires interpreting the extracted string from the logs, derived methods should override this class' calcProgress() method. See the docstring for this class' calcProgress()

Instance Methods [hide private]
 
__init__(self, job)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
dict of lists
parse(self, data, qbTokens=None)
Scan the log stream for matches to the job's various regexes.
source code
float
calcProgress(self, progressMatchStr, *args)
Calculate the internal progress of a piece of work (or a cmdline job) and return it as a float between 0 and 1.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, job)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • job (qb.Job)
Overrides: object.__init__

parse(self, data, qbTokens=None)

source code 

Scan the log stream for matches to the job's various regexes.

Return a dict of lists, key is the regex name as specificied in the job package with the leading 'regex_' stripped, the list is all matches for the regex. Only return non-empty lists.

Parameters:
  • qbTokens (dict) - a dictionary containing all the QB_FRAME* values to aid in calculation the in-chunk progress.
  • data (str)
Returns: dict of lists

calcProgress(self, progressMatchStr, *args)

source code 

Calculate the internal progress of a piece of work (or a cmdline job) and return it as a float between 0 and 1.

The extraction of the progress value via the job's "progress" regular expression is only the first aspect of determining how close a particular chunk is to completing; the other part is figuring out what to do with the frame or the "% complete" string that's been pulled out of the log stream and converting it into the expected numerical range so that the QubeGUI knows what to do with it.

2-digit precision is preferred, more precision will be truncated in the QubeGUI.

It is expected that this method be overridden for any log parser that is expected to calculate a "done" value from the log contents.

Parameters:
  • progressMatchStr (str) - the value used to derive the progress within the chunk. It is simply the progress percentage integer matched in the application output.
Returns: float
The amount of work complete for the item, expressed as a float between 0 and 1.0, 1.0 being completely done.