Skip to content

State

Stream Processor state interface.

kxi.sp.state.__all__ = ['Pickle', 'Unpickle', 'get', 'set'] module-attribute

kxi.sp.state.Unpickle

Bases: IntEnum

kxi.sp.state.Unpickle.false = False class-attribute

kxi.sp.state.Unpickle.true = True class-attribute

kxi.sp.state.Unpickle.auto = 2 class-attribute

kxi.sp.state.Pickle

Bases: IntEnum

kxi.sp.state.Pickle.false = False class-attribute

kxi.sp.state.Pickle.true = True class-attribute

kxi.sp.state.__dir__

kxi.sp.state.get

Get the state of an operator.

Parameters:

Name Type Description Default
operator Operator

The operator, specified as a configuration dictionary or name.

required
metadata Metadata

The metadata dictionary, provided for specialized data retrieval.

required
unpickle Unpickle

A Unpickle enum value representing whether the retrieved data should be unpickled. Can be provided as a boolean. Defaults to Unpickle.auto, which unpickles the data only if it appears to be bytes in a pickled format.

Unpickle.auto

Returns:

Type Description
Any

The data that was stored in the operator's state.

kxi.sp.state.set

Set the state of an operator.

Parameters:

Name Type Description Default
operator Operator

The operator, specified as a configuration dictionary or name.

required
metadata Metadata

The metadata dictionary, provided for specialized data storage.

required
data Any

The data to be stored. By default the data will be converted to a pykx.K object using the default conversion logic. To store the object as-is set pickle=True.

required
pickle Pickle

A Pickle enum value representing whether the data should be pickled or not. Can be provided as a boolean.

Pickle.false

Returns:

Type Description
Any

The data that was stored in the operator's state.