checkQC.handlers.qc_handler module

class checkQC.handlers.qc_handler.QCErrorFatal(msg, ordering=1, data=None)[source]

Bases: checkQC.handlers.qc_handler.QCHandlerReport

Class representing a fatal QC error from a handler, i.e. a value which should in the end yield a non-zero exit status from the program.

type()[source]

Should be implemented by the subclass.

Returns:String with the type of the report, e.g. “error” or “warning”
class checkQC.handlers.qc_handler.QCErrorWarning(msg, ordering=1, data=None)[source]

Bases: checkQC.handlers.qc_handler.QCHandlerReport

Class representing a QC warning from a handler, i.e. a value is interesting to note, but which should still yield a zero exit status from the program.

type()[source]

Should be implemented by the subclass.

Returns:String with the type of the report, e.g. “error” or “warning”
class checkQC.handlers.qc_handler.QCHandler(qc_config)[source]

Bases: checkQC.handlers.qc_handler.Subscriber

The QCHandler is one of the fundamental classes of CheckQC. It is the base class for the the concrete implementations of QCHandlers which actually check the the quality criteria of a runfolder. For examples of how to implement a QCHandler it is easiest to look at the implementations available in the checkQC.handlers module

ERROR = 'error'
UNKNOWN = 'unknown'
WARNING = 'warning'
check_qc()[source]

The check_qc method provides the core behaviour of the QCHandler. It should check the values provided to it and yield instances of QCHandlerReport (or continue, if there was nothing to report)

Returns:An instance of QCHandlerReport
custom_configuration_validation()[source]

Override this method in subclass to provide additional configuration behaviour.

Raises:ConfigurationError if there is a problem with the configuration
error()[source]

The value associated with a QC error

Returns:The configuration value for an error
exit_status()[source]

The exit status of the handler.

Returns:0 if the qc criteria have not encountered a fatal qc error, else 1.
parser()[source]

The class of the Parser (or a list of parsers) which this QCHandler will get its data from. E.g.

def parser(self):
    return InteropParser

Note that there should be no parenthesis after the class.

Returns:The Parser implementation needed by this QCHandler
report()[source]

Check the quality criteria as specified in check_qc and gather all reports. Will set the objects exit_status in accordance with what types of reports are found.

Returns:A sorted list of errors and warnings found when evaluating the qc criteria.
validate_configuration()[source]

This method will validate the configuration which has been passed to the QCHandler. This should be called by the class making use of this instance. It will not be called automatically e.g. at object creation.

Returns:None
Raises:ConfigurationError if there is a problem with the configuration
warning()[source]

The value associated with a QC warning

Returns:The configuration value for an warning
class checkQC.handlers.qc_handler.QCHandlerReport(msg, ordering=1, data=None)[source]

Bases: object

Base class of objects which contain reports from a QCHandler

as_dict()[source]

Dump the class as a dictionary

Returns:A dict of representing this QCHandlerReport
type()[source]

Should be implemented by the subclass.

Returns:String with the type of the report, e.g. “error” or “warning”
class checkQC.handlers.qc_handler.Subscriber[source]

Bases: object

Subscriber defines the behaviour necessary to subscribe to data from a Parser. The implementing subclass has to implement the collect method. This method can decide which objects sent to the Subscriber that are of interest to that particular Subscriber, and what should be done with those values.

collect(signal)[source]

The implementing subclass should provide this method. It is up to instance receiving the data to decide how to handle it. Below is an example of how to handle a tuple with a key-value pair.

class MySubscriber(Subscriber):

    def __init__(self):
        self.results = []

    def collect(self, signal):
        key, value = signal
        if key == "my_key":
            self.results.append(value)
Returns:None
send(value)[source]

Will send the specified value to the subscriber

Parameters:value – Value to send to subscriber
Returns:None
subscribe()[source]

This method picks up data from the parser to which the Subscriber is listening.

Returns:None