pyleus.storm.bolt

Module containing the implementation of the Bolt component and a subclassed SimpleBolt component which takes care of acking/failing tuples and exposing a nicer API for handling tick tuples.

class pyleus.storm.bolt.Bolt(input_stream=None, output_stream=None)[source]

Bolt component class. Inherit from Component.

ack(tup)[source]

Ack a tuple.

Parameters:tup (StormTuple) – tuple to ack

Note

All tuples need to be acked or failed, independently whether you are using Storm reliability features or not. If you are directly using Bolt instead of SimpleBolt, you must call this method or your topology will eventually run out of memory or hang.

emit(values, stream=None, anchors=None, direct_task=None, need_task_ids=True)[source]

Build and send an output tuple command dict and return the ids of the tasks to which the tuple was sent by Storm.

Parameters:
  • values (tuple or list) – pyleus tuple values to be emitted
  • stream (str) – output stream the message is going to belong to, default DEFAULT
  • anchors (list of pyleus tuples) – list of pyleus tuples the message should be anchored to, default None
  • direct_task (int) – task message will be sent to, default None
  • need_task_ids (bool) – whether emit should return the ids of the task the message has been sent to, default True

Tip

Setting need_task_ids to False really helps in achieving better performances. You should always do that if your application does not leverage task ids.

Danger

direct_task is not yet supported.

fail(tup)[source]

Fail a tuple.

Parameters:tup (StormTuple) – tuple to fail

Note

All tuples need to be acked or failed, independently whether you are using Storm reliability features or not. If you are directly using Bolt instead of SimpleBolt, you must call this method or your topology will eventually run out of memory or hang.

process_tuple(tup)[source]

Process the incoming tuple.

Parameters:tup (StormTuple) – pyleus tuple representing the message to be processed

Note

Implement in subclass.

sync()[source]

Respond to heartbeat.

class pyleus.storm.bolt.SimpleBolt(input_stream=None, output_stream=None)[source]

A Bolt that automatically acks/fails tuples.

Implement process_tick() in a subclass to handle tick tuples with a nicer API.

process_tick()[source]

Code to be executed when a tick tuple reaches the component.

Note

Implement in subclass.