nvflare.apis.filter module

exception ContentBlockedException[source]

Bases: Exception

A filter should raise this exception when the content is to be blocked

class Filter[source]

Bases: FLComponent, ABC

Init FLComponent.

The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)

FLComponents have the capability to handle and fire events and contain various methods for logging.

get_prop(key: str, default=None)[source]
abstract process(shareable: Shareable, fl_ctx: FLContext) Shareable[source]

Filter process applied to the Shareable object.

Parameters:
  • shareable – shareable

  • fl_ctx – FLContext

Returns:

a Shareable object

set_prop(key: str, value)[source]
class FilterChainType[source]

Bases: object

TASK_DATA_CHAIN = 'task_data'
TASK_RESULT_CHAIN = 'task_result'
class FilterContextKey[source]

Bases: object

CHAIN_TYPE = '__chain_type'
SOURCE = '__source'
class FilterSource[source]

Bases: object

JOB = 'job'
SITE = 'site'