AnnotatedPartialOutputsError#
- exception lsst.pipe.base.AnnotatedPartialOutputsError#
Bases:
RepeatableQuantumErrorException that runQuantum raises when the (partial) outputs it has written contain information about their own incompleteness or degraded quality.
Clients should construct this exception by calling
annotateinstead of calling the constructor directly. However,annotatedoes not chain the exception; this must still be done by the client.This exception should always chain the original error. When the executor catches this exception, it will report the original exception. In contrast, other exceptions raised from
runQuantumare considered to invalidate any outputs that are already written.- classmethod annotate(error: Exception, *args: GetSetDictMetadataHolder | None, log: Logger | LsstLogAdapter) AnnotatedPartialOutputsError#
Set metadata on outputs to explain the nature of the failure.
Parameters#
- error
Exception Exception that caused the task to fail.
- *args
GetSetDictMetadataHolder Objects (e.g. Task, Exposure, SimpleCatalog) to annotate with failure information. They must have a
metadataproperty.- log
logging.Logger Log to send error message to.
Returns#
- error
AnnotatedPartialOutputsError Exception that the failing task can
raise fromwith the passed-in exception.
Notes#
This should be called from within an except block that has caught an exception. Here is an example of handling a failure in
PipelineTask.runQuantumthat annotates and writes partial outputs:def runQuantum(self, butlerQC, inputRefs, outputRefs): inputs = butlerQC.get(inputRefs) exposures = inputs.pop("exposures") assert not inputs, "runQuantum got more inputs than expected" result = pipeBase.Struct(catalog=None) try: self.run(exposure) except pipeBase.AlgorithmError as e: error = pipeBase.AnnotatedPartialOutputsError.annotate( e, self, result.catalog, log=self.log ) raise error from e finally: butlerQC.put(result, outputRefs)
- error