lenskit.pipeline.PipelineState#

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

Bases: 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.

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 (PipelineMeta | None) – The metadata for the pipeline generating this state.

__init__(state=None, aliases=None, default=None, meta=None)#
Parameters:
Return type:

None

Methods

__init__([state, aliases, default, meta])

get(k[,d])

items()

keys()

values()

Attributes

default

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

default_node

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

meta

Pipeline metadata.

meta: 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.

property default_node: str | None#

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