florist.api.servers.config_parsers module

Parsers for FL server configurations.

class BasicConfigParser[source]

Bases: object

Parser for basic server configurations.

classmethod mandatory_fields()[source]

Define the mandatory fields for basic configuration, namely n_server_rounds, batch_size and local_epochs.

Return type:

List[str]

Returns:

(List[str]) the list of fields for basic server configuration.

classmethod parse(config_json_str)[source]

Parse a configuration JSON string into a dictionary.

Parameters:

config_json_str (str) – (str) the configuration JSON string

Return type:

Dict[str, Any]

Returns:

(Dict[str, Any]) The configuration JSON string parsed as a dictionary.

class ConfigParser(value)[source]

Bases: Enum

Enum to define the types of server configuration parsers.

BASIC = 'BASIC'
classmethod class_for_parser(config_parser)[source]

Return the class for a given config parser.

Parameters:

config_parser (ConfigParser) – (ConfigParser) The config parser enumeration instance.

Return type:

type[BasicConfigParser]

Returns:

(type[BasicConfigParser]) A subclass of BasicConfigParser corresponding to the given config parser.

Raises:

ValueError – if the config_parser is not supported.

classmethod list()[source]

List all the supported config parsers.

Return type:

List[str]

Returns:

(List[str]) a list of supported config parsers.

exception IncompleteConfigError[source]

Bases: Exception

Defines errors in server config strings that have incomplete information.