Platform#

Generic platform#

class pfl.internal.platform.generic_platform.Platform#

Collection of properties and methods related to compute platforms

abstract consume_metrics(metrics, iteration, context=None)#

Process task status and metrics.

abstract create_checkpoint_directories(subdir_names)#

Given a list of directories, creates the directories either in the current working directory if executed on a local computer or on a remote compute platform.

abstract get_distributed_addresses(verbose=False)#

Get all IP addresses of compute nodes when running in a distributed context.

abstract get_platform_context()#

Get a string-keyed dict of platform context information.

Return type:

Dict[str, str]

abstract get_default_callbacks()#

Get a list of callbacks to add to algorithms using this platform.

Return type:

List[TrainingProcessCallback]

class pfl.internal.platform.generic_platform.GenericPlatform#
consume_metrics(metrics, iteration, context=None)#

Send metrics to platform, which may e.g. output them on the terminal or display on a dashboard.

Parameters:
  • metrics (Metrics) – Metrics to output.

  • iteration (int) – Current iteration.

  • context (Optional[Dict]) – An optional dict defining the context, e.g. hyperparameters used.

create_checkpoint_directories(subdir_names)#

Given a list of directories, creates the directories in appropriate location on the current platform.

Parameters:

subdir_names – A list of directory names to create.

Return type:

List

Returns:

A list of the paths for every new directory.

get_distributed_addresses(verbose=False)#

Get all IP addresses of compute nodes when running in a distributed context.

Return type:

Tuple

get_platform_context()#

Get a string-keyed dict of platform context information.

Return type:

Dict[str, str]

get_default_callbacks()#

Get a list of callbacks to add to algorithms using this platform.

Return type:

List[TrainingProcessCallback]

Selector#

pfl.internal.platform.selector.get_platform()#

Get the current platform. If the platform is not set, return the default platform pfl.internal.platform.GenericPlatform.

pfl.internal.platform.selector.set_platform(module)#

Manually set the platform module. Can be useful when you are running on an unsupported platform and made a custom integration for it.