fedn.utils package

The utils package is responsible for providing utility functions for the FEDn framework. Such as logging, checksums and other model helper functions to aggregate models. THe helper functions is there to support aggregating various models from different ML frameworks, such as Tensorflow, PyTorch and Keras.

Subpackages

Submodules

fedn.utils.checksum module

fedn.utils.checksum.sha(fname)[source]

Calculate the sha256 checksum of a file. Used for computing checksums of compute packages.

Parameters:

fname (str) – The file path.

Returns:

The sha256 checksum.

Return type:

hashlib.sha256

fedn.utils.dispatcher module

class fedn.utils.dispatcher.Dispatcher(config, dir)[source]

Bases: object

Dispatcher class for compute packages.

Parameters:
  • config (dict) – The configuration.

  • dir (str) – The directory to dispatch to.

run_cmd(cmd_type)[source]

Run a command.

Parameters:

cmd_type (str) – The command type.

Returns:

fedn.utils.process module

fedn.utils.process.run_process(args, cwd)[source]

Run a process and log the output.

Parameters:
  • args (list) – The arguments to the process.

  • cwd (str) – The current working directory.

Returns: