fluxus.core.producer.SimpleConcurrentProducer#

class fluxus.core.producer.SimpleConcurrentProducer(*producers)[source]#

A simple group that manages a collection of producers.

Bases:

ConcurrentProducer [+T_SourceProduct_ret]

Generic types:

+T_SourceProduct_ret

Metaclasses:

ABCMeta

Parameters:

producers (BaseProducer[TypeVar(T_SourceProduct_ret, covariant=True)]) – the response producer(s) this producer uses to generate response groups

Method summary

aproduce

Generate new products from all producers in this group asynchronously.

draw

Draw the flow.

get_connections

Get the connections between conduits in this conduit.

get_final_conduits

Get an iterator yielding the final atomic conduit or conduits of the (sub)flow represented by this conduit.

get_isolated_conduits

Get an iterator yielding the isolated conduits in this conduit.

iter_concurrent_producers

Iterate over the concurrent producers that make up this (potentially) composite producer.

produce

Generate new products from all producers in this group.

to_expression

Make an expression representing this conduit.

Attribute summary

final_conduit

self, since this is a group of concurrent conduits and has no final conduit on a more granular level.

is_atomic

True if this conduit is atomic, False if it is a chained or concurrent composition of other conduits.

is_chained

True if this conduit contains a composition of conduits chained together sequentially, False otherwise.

is_concurrent

True, since this is a group of concurrent conduits.

n_concurrent_conduits

The number of concurrent conduits in this conduit.

name

The name of this conduit.

product_type

The type of the products produced by this conduit.

producers

The response sources this producer provides.

Definitions

aproduce()#

Generate new products from all producers in this group asynchronously.

Return type:

AsyncIterator[TypeVar(T_SourceProduct_ret, covariant=True)]

Returns:

an async iterator of the new products

draw(style='graph')#

Draw the flow.

Parameters:

style (str) – the style to use for drawing the flow, see FlowDrawer for available styles (defaults to “graph”)

Return type:

None

get_connections(*, ingoing)[source]#

Get the connections between conduits in this conduit.

Parameters:

ingoing (Collection[SerialConduit[Any]]) – the ingoing conduits, if any

Return type:

Iterator[tuple[SerialConduit[Any], SerialConduit[Any]]]

Returns:

an iterator yielding connections between conduits

get_final_conduits()[source]#

Get an iterator yielding the final atomic conduit or conduits of the (sub)flow represented by this conduit.

If this conduit is atomic, yields the conduit itself.

If this conduit is a sequential composition of conduits, yields the final conduit of that sequence.

If this conduit is a group of concurrent conduits, yields the final conduits of each of the concurrent conduits.

Return type:

Iterator[SerialConduit[TypeVar(T_SourceProduct_ret, covariant=True)]]

Returns:

an iterator yielding the final conduits

get_isolated_conduits()[source]#

Get an iterator yielding the isolated conduits in this conduit.

An isolated conduit is a conduit that is not connected to any other conduit in the flow.

Return type:

Iterator[SerialConduit[TypeVar(T_SourceProduct_ret, covariant=True)]]

Returns:

an iterator yielding the isolated conduits

iter_concurrent_producers()[source]#

Iterate over the concurrent producers that make up this (potentially) composite producer.

Return type:

Iterator[SerialProducer[TypeVar(T_SourceProduct_ret, covariant=True)]]

Returns:

an iterator over the concurrent producers

produce()#

Generate new products from all producers in this group.

Return type:

Iterator[TypeVar(T_SourceProduct_ret, covariant=True)]

Returns:

an iterator of the new products

to_expression(*, compact=False)[source]#

Make an expression representing this conduit.

Parameters:

compact (bool) – if True, use a compact representation using only the subset of conduit attributes from get_repr_attributes(); if False, generate the full representation using all attributes

Return type:

Expression

Returns:

the expression representing this conduit

property final_conduit: Self#

self, since this is a group of concurrent conduits and has no final conduit on a more granular level.

property is_atomic: bool#

True if this conduit is atomic, False if it is a chained or concurrent composition of other conduits.

property is_chained: bool#

True if this conduit contains a composition of conduits chained together sequentially, False otherwise.

property is_concurrent: bool#

True, since this is a group of concurrent conduits.

property n_concurrent_conduits: int#

The number of concurrent conduits in this conduit.

property name: str#

The name of this conduit.

producers: tuple[BaseProducer[TypeVar(T_SourceProduct_ret, covariant=True)], ...]#

The response sources this producer provides.

property product_type: type[T_SourceProduct_ret]#

The type of the products produced by this conduit.