nvflare.app_common.streamers.streamer_base module

class BaseChunkConsumer[source]

Bases: ObjectConsumer

Base for chunk-based consumers.

Provides shared data-chunk size validation. Subclasses must implement consume.

class BaseChunkProducer[source]

Bases: ObjectProducer

Base for chunk-based producers.

Provides the common process_replies implementation shared by FileStreamer and LogStreamer. Subclasses must implement produce.

process_replies(replies, stream_ctx, fl_ctx)[source]

Called to process replies from receivers of the last Shareable object sent to them.

Parameters:
  • replies – replies from receivers. It’s dict of site_name => reply

  • stream_ctx – stream context data

  • fl_ctx – the FLContext object

Returns: Any object or None

If None is returned, the streaming will continue; otherwise the streaming stops and the returned object is returned as the final result of the streaming.

class StreamerBase[source]

Bases: object

This is the base class for all future streamers. This base class provides methods for accessing common properties in the StreamContext. When a streamer class is defined as a subclass of this base, then all such StreamContext accessing methods will be inherited.

static get_channel(ctx: dict)[source]
static get_rc(ctx: dict)[source]
static get_topic(ctx: dict)[source]