A node in a Pregel graph. This won't be invoked as a runnable by the graph itself, but instead acts as a container for the components necessary to make a PregelExecutableTask for a node.
PregelNode(
self,
*,
channels: str | list[str],
triggers: Sequence[str],
mapper: Callable[[Any], Any] | None = None,
writers: list[Runnable] | None = None,
tags: list[str] | None = None,
metadata: Mapping[str, Any] | None = None,
bound: Runnable[Any, Any] | None = None,
retry_policy: RetryPolicy | Sequence[RetryPolicy] | None = None,
cache_policy: CachePolicy | None = None,
subgraphs: Sequence[PregelProtocol] | None = None
)| Name | Type |
|---|---|
| channels | str | list[str] |
| triggers | Sequence[str] |
| mapper | Callable[[Any], Any] | None |
| writers | list[Runnable] | None |
| tags | list[str] | None |
| metadata | Mapping[str, Any] | None |
| bound | Runnable[Any, Any] | None |
| retry_policy | RetryPolicy | Sequence[RetryPolicy] | None |
| cache_policy | CachePolicy | None |
| subgraphs | Sequence[PregelProtocol] | None |
The channels that will be passed as input to bound.
If a str, the node will be invoked with its value if it isn't empty.
If a list, the node will be invoked with a dict of those channels' values.
If any of these channels is written to, this node will be triggered in the next step.
A function to transform the input before passing it to bound.
A list of writers that will be executed after bound, responsible for
taking the output of bound and writing it to the appropriate channels.
The main logic of the node. This will be invoked with the input from
channels.
The retry policies to use when invoking the node.
The cache policy to use when invoking the node.
Tags to attach to the node for tracing.
Metadata to attach to the node for tracing.
Subgraphs used by the node.
Get writers with optimizations applied. Dedupes consecutive ChannelWrites.
Get a runnable that combines bound and writers.
Get a cache key for the input to the node. This is used to avoid calculating the same input multiple times.