nvflare.lighter.entity module

class Entity(scope: str, name: str, props: dict, parent=None)[source]

Bases: object

get_prop(key: str, default=None)[source]
get_prop_fb(key: str, fb_key=None, default=None)[source]

Get property value with fallback. If I have the property, then return it. If not, I return the fallback property of my parent. If I don’t have parent, return default.

Parameters:
  • key – key of the property

  • fb_key – key of the fallback property.

  • default – value to return if no one has the property

Returns: property value

class Participant(type: str, name: str, org: str, props: dict | None = None, project: Entity | None = None)[source]

Bases: Entity

Class to represent a participant.

Each participant communicates to other participant. Therefore, each participant has its own name, type, organization it belongs to, rules and other information.

Parameters:
  • type (str) – server, client, admin or other string that builders can handle

  • name (str) – system-wide unique name

  • org (str) – system-wide unique organization

  • props (dict) – properties

  • project – the project that the participant belongs to

Raises:

ValueError – if name or org is not compliant with characters or format specification.

get_default_host() str[source]

Get the default host name for accessing this participant (server). If the “default_host” attribute is explicitly specified, then it’s the default host. If the “default_host” attribute is not explicitly specified, then use the “name” attribute.

Returns: a host name

class Project(name: str, description: str, participants=None, props: dict | None = None, serialized_root_cert=None, serialized_root_private_key=None)[source]

Bases: Entity

A container class to hold information about this FL project.

This class only holds information. It does not drive the workflow.

Parameters:
  • name (str) – the project name

  • description (str) – brief description on this name

  • participants – if provided, list of participants of the project

  • props – properties of the project

  • serialized_root_cert – if provided, the root cert to be used for the project

  • serialized_root_private_key – if provided, the root private key for signing certs of sites and admins

Raises:

ValueError – when participant criteria is violated

add_admin(name: str, org: str, props: dict)[source]
add_client(name: str, org: str, props: dict)[source]
get_admins()[source]
get_all_participants()[source]
get_clients()[source]
get_overseer()[source]

Get the overseer definition. Only one overseer is supported!

Returns: overseer participant

get_server()[source]

Get the server definition. Only one server is supported!

Returns: server participant

set_overseer(name: str, org: str, props: dict)[source]
set_server(name: str, org: str, props: dict)[source]