Class - CutoffTimePolicy#
- class openfl.component.aggregator.straggler_handling.CutoffTimePolicy(round_start_time=None, straggler_cutoff_time=inf, minimum_reporting=1, **kwargs)[source]#
Bases:
StragglerPolicyCutoff time based Straggler Handling function.
- __init__(round_start_time=None, straggler_cutoff_time=inf, minimum_reporting=1, **kwargs)[source]#
Initialize a CutoffTimePolicy object.
- Parameters:
round_start_time (optional) – The start time of the round. Defaults to None.
straggler_cutoff_time (float, optional) – The cutoff time for stragglers. Defaults to np.inf.
minimum_reporting (int, optional) – The minimum number of collaborators that should report before moving to the next round. Defaults to 1.
**kwargs – Variable length argument list.
Methods
__init__([round_start_time, ...])Initialize a CutoffTimePolicy object.
Reset timer for the next round.
start_policy(callback)Start time-based straggler handling policy for collaborator for a particular round.
If minimum_reporting collaborators have reported results within straggler_cutoff_time then return True, otherwise False.
- start_policy(callback)[source]#
Start time-based straggler handling policy for collaborator for a particular round.
- Parameters:
callback (Callable) – Callable Callback function for when straggler_cutoff_time elapses
- Return type:
None
- straggler_cutoff_check(num_collaborators_done, num_all_collaborators)[source]#
If minimum_reporting collaborators have reported results within straggler_cutoff_time then return True, otherwise False.
- Parameters:
num_collaborators_done (int) – int Number of collaborators finished.
num_all_collaborators (int) – int Total number of collaborators.
- Returns:
True if the straggler cutoff conditions are met, False otherwise.
- Return type:
bool