Class - fedtiming#

class openfl.utilities.fed_timer.fedtiming(timeout)[source]#

Bases: SyncAsyncTaskDecoFactory

FedTiming decorator factory.

This class is a factory for creating decorators for timing synchronous and asynchronous tasks.

timeout#

The maximum time to allow for the function’s execution.

Type:

int

__init__(timeout)[source]#

Initialize a FedTiming object.

Parameters:
  • timeout (int) – The maximum time to allow for the function’s

  • execution.

Methods

__init__(timeout)

Initialize a FedTiming object.

wrapper(func, *args, **kwargs)

Create a context for the decorated function.

wrapper(func, *args, **kwargs)[source]#

Create a context for the decorated function.

This method sets up the task for execution and measures its execution time. Yields the control back to async_wrapper or sync_wrapper function call.

Parameters:
  • func (function) – The function to be decorated.

  • args (tuple) – The positional arguments to pass to the function.

  • kwargs (dict) – The keyword arguments to pass to the function.

Yields:

None

Raises:

Exception – If an error occurs during the function’s execution raised by async_wrapper or sync_wrapper and terminates the execution..