import pipeline.infrastructure.basetask as basetask
import pipeline.infrastructure.logging as logging
import pipeline.infrastructure.pipelineqa as pqa
import pipeline.infrastructure.utils as utils
from . import imageprecheck
LOG = logging.get_logger(__name__)
[docs]class ImagePreCheckQAHandler(pqa.QAPlugin):
result_cls = imageprecheck.ImagePreCheckResults
child_cls = None
[docs] def handle(self, context, result):
if result.score is not None:
score, longmsg, shortmsg = result.score
elif result.error:
score = 0.0
longmsg = shortmsg = result.error_msg
else:
score = 0.0
longmsg = shortmsg = 'No score information'
result.qa.pool[:] = [pqa.QAScore(score, longmsg=longmsg, shortmsg=shortmsg)]
[docs]class ImagePreCheckListQAHandler(pqa.QAPlugin):
result_cls = basetask.ResultsList
child_cls = imageprecheck.ImagePreCheckResults
[docs] def handle(self, context, result):
# collate the QAScores from each child result, pulling them into our
# own QAscore list
collated = utils.flatten([r.qa.pool for r in result])
result.qa.pool[:] = collated