openfl.utilities.fed_timer.fedtiming
- class openfl.utilities.fed_timer.fedtiming(timeout)
Bases:
SyncAsyncTaskDecoFactoryFedTiming decorator factory.
This class is a factory for creating decorators for timing synchronous and asynchronous tasks.
- Class Attributes:
timeout (int) – The maximum time to allow for the function’s execution.
Methods
Create a context for the decorated function.
- __call__(func)
Decorate the function. Call to @fedtiming() executes __call__() method delegated from the derived class fedtiming implementing SyncAsyncTaskDecoFactory.
- Parameters:
func (function) – The function to be decorated.
- Returns:
function – The decorated function.
- wrapper(func, *args, **kwargs)
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..