Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions python/lsst/pipe/base/_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import enum
import logging
import sys
from collections.abc import MutableMapping
from typing import TYPE_CHECKING, Any, ClassVar, Protocol

import pydantic
Expand Down Expand Up @@ -359,7 +360,7 @@ class GetSetDictMetadataHolder(Protocol):
"""

@property
def metadata(self) -> GetSetDictMetadata | None:
def metadata(self) -> GetSetDictMetadata | MutableMapping[str, Any] | None:
pass


Expand Down Expand Up @@ -500,7 +501,8 @@ def annotate(
Exception that caused the task to fail.
*args : `GetSetDictMetadataHolder`
Objects (e.g. Task, Exposure, SimpleCatalog) to annotate with
failure information. They must have a `metadata` property.
failure information. They must have a `metadata` property that
is a `~collections.abc.MutableMapping`.
log : `logging.Logger`
Log to send error message to.

Expand Down Expand Up @@ -548,7 +550,10 @@ def runQuantum(self, butlerQC, inputRefs, outputRefs):
# Some outputs may not exist, so we cannot set metadata on them.
if item is None:
continue
item.metadata.set_dict("failure", failure_info) # type: ignore
if hasattr(item.metadata, "set_dict"):
item.metadata.set_dict("failure", failure_info) # type: ignore
elif isinstance(item.metadata, MutableMapping):
item.metadata["failure"] = failure_info

log.debug(
"Task failed with only partial outputs; see exception message for details.",
Expand Down
Loading