lenskit.pipeline.PipelineState#

class lenskit.pipeline.PipelineState(state=None, aliases=None, default=None, meta=None)#

Bases: collections.abc.Mapping[str, Any]

Full results of running a pipeline. A pipeline state is a dictionary mapping node names to their results; it is implemented as a separate class instead of directly using a dictionary to allow data to be looked up by node aliases in addition to original node names (and to be read-only).

Client code will generally not construct this class directly.

Stability:

Calller

Parameters:
  • state (dict[str, Any] | None) – The pipeline state to wrap. The state object stores a reference to this dictionary.

  • aliases (dict[str, str] | None) – Dictionary of node aliases.

  • default (str | None) – The name of the default node (whose data should be returned by default ).

  • meta (lenskit.pipeline.config.PipelineMeta | None) – The metadata for the pipeline generating this state.

meta: lenskit.pipeline.config.PipelineMeta | None#

Pipeline metadata.

property default: Any#

Return the data from of the default node (typically the last node run).

Returns:

The data associated with the default node.

Raises:

ValueError – if there is no specified default node.

Return type:

Any

property default_node: str | None#

Return the name of the default node (typically the last node run).

Return type:

str | None

__len__()#
__contains__(key)#
Parameters:

key (object)

Return type:

bool

__getitem__(key)#
Parameters:

key (str)

Return type:

Any

__iter__()#
Return type:

Iterator[str]

__str__()#
Return type:

str

__repr__()#
Return type:

str