bytewax.connectors.demo#

Connectors for writing local-first demo dataflows.

Data#

X: TypeVar#

Classes#

class RandomMetricSource(
metric_name: str,
interval: timedelta = timedelta(seconds=0.7),
count: int = sys.maxsize,
next_random: Callable[[], float] = lambda : ...,
)#
Bases:

Demo source that produces an infinite stream of random values.

Emits downstream (metric_name, val) 2-tuples.

If you want to emit multiple different metrics, create multiple input steps and merge them.

Initialization

Init.

Parameters:
  • metric_name – To attach to each value.

  • interval – Emit a value on this cadence. Defaults to every 0.7 seconds.

  • count – Number of values to generate. Defaults to infinite.

  • next_random – Callable used to generate the next random value. Defaults to a random int between 0 and 10.

list_parts() List[str]#
build_part(
step_id: str,
for_part: str,
resume_state: Optional[bytewax.connectors.demo._RandomMetricState],
)#
Join our community Slack channel

Need some help? Join our community!

If you have any trouble with the process or have ideas about how to improve this document, come talk to us in the #questions-answered Slack channel!

Join now