ait.core.server.stream module

class ait.core.server.stream.PortInputStream(name, inputs, handlers, zmq_args=None)

Bases: ait.core.server.stream.Stream, ait.core.server.client.PortInputClient

This stream type listens for messages from a UDP port and publishes to a ZMQ socket.

__init__(name, inputs, handlers, zmq_args=None)
Params:

name: string name of stream (should be unique) inputs: list of inputs to stream.

if input is int, port number to receive messages on if input is string, stream or plugin name to receive

messages from

handlers: list of handlers (empty list if no handlers for stream) zmq_args: (optional) dict containing the follow keys:

zmq_context zmq_proxy_xsub_url zmq_proxy_xpub_url

Defaults to empty dict here. Default values assigned during instantiation of parent class.

**kwargs: (optional) Depends on requirements of child class

Raises:
ValueError: if workflow is not found to be valid based on handlers’
provided input and output types
class ait.core.server.stream.PortOutputStream(name, inputs, output, handlers, zmq_args=None)

Bases: ait.core.server.stream.Stream, ait.core.server.client.PortOutputClient

This stream type listens for messages from another stream or plugin and publishes to a UDP port.

__init__(name, inputs, output, handlers, zmq_args=None)
Params:

name: string name of stream (should be unique) inputs: list of inputs to stream.

if input is int, port number to receive messages on if input is string, stream or plugin name to receive

messages from

handlers: list of handlers (empty list if no handlers for stream) zmq_args: (optional) dict containing the follow keys:

zmq_context zmq_proxy_xsub_url zmq_proxy_xpub_url

Defaults to empty dict here. Default values assigned during instantiation of parent class.

**kwargs: (optional) Depends on requirements of child class

Raises:
ValueError: if workflow is not found to be valid based on handlers’
provided input and output types
class ait.core.server.stream.Stream(name, inputs, handlers, zmq_args=None, **kwargs)

Bases: object

This is the base Stream class that all streams will inherit from. It calls its handlers to execute on all input messages sequentially, and validates the handler workflow if handler input and output types were specified.

__init__(name, inputs, handlers, zmq_args=None, **kwargs)
Params:

name: string name of stream (should be unique) inputs: list of inputs to stream.

if input is int, port number to receive messages on if input is string, stream or plugin name to receive

messages from

handlers: list of handlers (empty list if no handlers for stream) zmq_args: (optional) dict containing the follow keys:

zmq_context zmq_proxy_xsub_url zmq_proxy_xpub_url

Defaults to empty dict here. Default values assigned during instantiation of parent class.

**kwargs: (optional) Depends on requirements of child class

Raises:
ValueError: if workflow is not found to be valid based on handlers’
provided input and output types
process(input_data, topic=None)

Invokes each handler in sequence. Publishes final output data. Terminates all handler calls and does not publish data if None is received from a single handler.

Params:

input_data: message received by stream topic: name of plugin or stream message received from,

if applicable
valid_workflow()

Return true if each handler’s output type is the same as the next handler’s input type. Return False if not.

Returns: boolean - True if workflow is valid, False if not

class ait.core.server.stream.ZMQStream(name, inputs, handlers, zmq_args=None)

Bases: ait.core.server.stream.Stream, ait.core.server.client.ZMQInputClient

This stream type listens for messages from another stream or plugin and publishes to a ZMQ socket.

__init__(name, inputs, handlers, zmq_args=None)
Params:

name: string name of stream (should be unique) inputs: list of inputs to stream.

if input is int, port number to receive messages on if input is string, stream or plugin name to receive

messages from

handlers: list of handlers (empty list if no handlers for stream) zmq_args: (optional) dict containing the follow keys:

zmq_context zmq_proxy_xsub_url zmq_proxy_xpub_url

Defaults to empty dict here. Default values assigned during instantiation of parent class.

**kwargs: (optional) Depends on requirements of child class

Raises:
ValueError: if workflow is not found to be valid based on handlers’
provided input and output types