schrodinger.seam.transforms.window module

class schrodinger.seam.transforms.window.StringIDWindow(window_id: str)

Bases: BoundedWindow

A window defined by an arbitrary string ID.

__init__(window_id: str)
class schrodinger.seam.transforms.window.StringIDWindowCoder

Bases: Coder

encode(value: StringIDWindow) bytes

Encodes the given object into a byte string.

decode(value: bytes)

Decodes the given byte string into the corresponding object.

is_deterministic() bool

Whether this coder is guaranteed to encode values deterministically.

A deterministic coder is required for key coders in GroupByKey operations to produce consistent results.

For example, note that the default coder, the PickleCoder, is not deterministic: the ordering of picked entries in maps may vary across executions since there is no defined order, and such a coder is not in general suitable for usage as a key coder in GroupByKey operations, since each instance of the same key may be encoded differently.

Returns:

Whether coder is deterministic.

to_runner_api_parameter(context)
static from_runner_api_parameter(unused_payload, unused_components, unused_context)
class schrodinger.seam.transforms.window.BatchWindows(size: int = 1)

Bases: NonMergingWindowFn

A windowing function that assigns each element to a window of a maximum given size.

The sized windows are not guaranteed to be fully filled.

__init__(size: int = 1)
assign(assign_context: AssignContext) Iterable[StringIDWindow]

Associates windows to an element.

Arguments:

assign_context: Instance of AssignContext.

Returns:

An iterable of BoundedWindow.

get_window_coder() Coder
class schrodinger.seam.transforms.window.StringIDWindows(id_func: Callable[[Any], str])

Bases: NonMergingWindowFn

A windowing function that assigns each element a window with ID based on the given callable.

__init__(id_func: Callable[[Any], str])
assign(assign_context: AssignContext) Iterable[StringIDWindow]

Associates windows to an element.

Arguments:

assign_context: Instance of AssignContext.

Returns:

An iterable of BoundedWindow.

get_window_coder() Coder