nvflare.edge.executors.hug module¶
- class HierarchicalUpdateGatherer(learner_id: str, updater_id: str, update_timeout)[source]¶
Bases:
ExecutorInit FLComponent.
The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)
FLComponents have the capability to handle and fire events and contain various methods for logging.
- accept_update(task_id: str, update: Shareable, fl_ctx: FLContext) bool[source]¶
This is to be called by subclass to accept a specified update
- Parameters:
task_id – ID of the task
update – the update to be accepted.
fl_ctx – FLContext object
Returns: whether the update is accepted
- execute(task_name: str, shareable: Shareable, fl_ctx: FLContext, abort_signal: Signal) Shareable[source]¶
Execute the assigned task. If we are a leaf node in client hierarchy, we’ll execute the task by using the configured executor for the task name “exec_<task_name>”. This way different tasks can be handled by different executors.
If we are not leaf node, we’ll wait for results from child clients and then aggregate their results using the configured aggregator.
- Parameters:
task_name – name of the assigned task
shareable – task data
fl_ctx – FLContext object
abort_signal – signal to notify abort
Returns: task result
- get_current_task(fl_ctx: FLContext) TaskInfo | None[source]¶
Get the info of current task
Returns: TaskInfo of current task or None if no current task
Note: During the life of the task processing, the “task” data of the TaskInfo could be updated many times.
- set_task_done(task_id: str, fl_ctx: FLContext) bool[source]¶
This method is to be called by subclass to forcefully end the specified task
- Parameters:
task_id – ID of the task to be ended
fl_ctx – FLContext object
Returns: whether this request is accepted