nvflare.apis.fl_context module¶
- class FLContext[source]¶
Bases:
object
Init the FLContext.
The FLContext is used to passed data between FL Components. It can be thought of as a dictionary that stores key/value pairs called props (properties).
- Visibility: private props are only visible to local components,
public props are also visible to remote components
- Stickiness: sticky props become available in all future FL Contexts,
non-sticky props will only be available in the current FL Context
- class FLContextManager(engine=None, identity_name: str = '', job_id: str = '', public_stickers=None, private_stickers=None)[source]¶
Bases:
object
FLContextManager manages the creation and updates of FLContext objects for a run.
NOTE: The engine may create a new FLContextManager object for each RUN!
Init the FLContextManager.
- Parameters:
engine – the engine that created this FLContextManager object
identity_name (str) – identity name
job_id – the job id
public_stickers – public sticky properties that are copied into or copied from
private_stickers – private sticky properties that are copied into or copied from
- check_sticker(key: str) -> (<class 'bool'>, typing.Any, <class 'int'>)[source]¶
Check whether a sticky prop exists in either the public or private group.
- Parameters:
key – the key of the sticker to be checked
Returns: tuple: whether the sticker exists, its value and mask if it exists