nvflare.app_opt.xgboost.histogram_based_v2.adaptors.adaptor module¶
- class AppAdaptor(app_name: str, in_process: bool)[source]¶
Bases:
ABC
,FLComponent
AppAdaptors are used to integrate FLARE with App Target (Server or Client) in run time.
Constructor of AppAdaptor.
- Parameters:
app_name (str) – The name of the application.
in_process (bool) – Whether to call the AppRunner.run() in the same process or not.
- abstract configure(config: dict, fl_ctx: FLContext)[source]¶
Called by XGB Controller/Executor to configure the adaptor. If any error occurs, this method should raise an exception.
- Parameters:
config – config data
fl_ctx – the FL context
Returns: None
- initialize(fl_ctx: FLContext)[source]¶
Called by the Controller/Executor to initialize the adaptor.
- Parameters:
fl_ctx – the FL context
Returns: None
- monitor_target(fl_ctx: FLContext, target_stopped_cb)[source]¶
Called by XGB Controller/Executor to monitor the health of the target.
The monitor periodically checks the abort signal. Once set, it calls the adaptor’s stop() method to stop the running of the target.
The monitor also periodically checks whether the target is already stopped (by calling the is_stopped method). If the target is stopped, the monitor will call the specified target_stopped_cb.
- Parameters:
fl_ctx – FL context
target_stopped_cb – the callback function to be called when the target is stopped.
Returns: None
- set_abort_signal(abort_signal: Signal)[source]¶
Called by XGB Controller/Executor to set the abort_signal.
The abort_signal is assigned by FLARE’s XGB Controller/Executor. It is used by the Controller/Executor to tell the adaptor that the job has been aborted.
- Parameters:
abort_signal – the abort signal assigned by the caller.
Returns: None
- set_runner(runner: AppRunner)[source]¶
Set the App Runner that will be used to run app processing logic. Note that the adaptor is only responsible for starting the runner appropriately (in a thread or in a separate process).
- Parameters:
runner (AppRunner) – the runner to be set
Returns: None
- abstract start(fl_ctx: FLContext)[source]¶
Called by XGB Controller/Executor to start the target. If any error occurs when starting the target, this method should raise an exception.
- Parameters:
fl_ctx – the FL context.
Returns: None