Documentation for Cflupdatehandler Module¶
CFLUpdateHandler
¶
Bases: UpdateHandler
Handles updates received in a cross-silo/federated learning setup, managing synchronization and aggregation across distributed nodes.
Attributes:
Name | Type | Description |
---|---|---|
_aggregator |
Aggregator
|
Reference to the aggregator managing the global model. |
_addr |
str
|
Local address of the node. |
_buffersize |
int
|
Max number of updates to store per node. |
_updates_storage |
dict
|
Stores received updates per source node. |
_sources_expected |
set
|
Set of nodes expected to send updates this round. |
_sources_received |
set
|
Set of nodes that have sent updates this round. |
_missing_ones |
set
|
Tracks nodes whose updates are missing. |
_role |
str
|
Role of this node (e.g., trainer or server). |
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
|
agg
property
¶
Returns the aggregator instance.
us
property
¶
Returns the internal updates storage dictionary.
get_round_missing_nodes()
async
¶
Returns nodes whose updates were expected but not received.
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
225 226 227 228 229 |
|
get_round_updates()
async
¶
Retrieves the latest updates received this round.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict[str, tuple[object, float]]
|
Mapping of source to (model, weight) tuples. |
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
init(config)
async
¶
Initializes the handler with the participant configuration, and subscribes to relevant node events.
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
86 87 88 89 90 91 92 93 |
|
notify_federation_update(updt_nei_event)
async
¶
Reacts to neighbor updates (e.g., join or leave).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
updt_nei_event
|
UpdateNeighborEvent
|
The neighbor update event. |
required |
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
notify_if_all_updates_received()
async
¶
Acquires a lock to notify the aggregator if all updates have been received.
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
231 232 233 234 235 236 237 238 239 240 241 |
|
round_expected_updates(federation_nodes)
async
¶
Sets the expected nodes for the current training round and updates storage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
federation_nodes
|
set
|
Nodes expected to send updates this round. |
required |
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
stop_notifying_updates()
async
¶
Stops waiting for updates and releases the notification lock if held.
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
243 244 245 246 247 248 249 |
|
storage_update(updt_received_event)
async
¶
Stores a received update if it comes from an expected source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
updt_received_event
|
UpdateReceivedEvent
|
The event containing the update. |
required |
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
Update
¶
Represents a model update received from a node in a specific training round.
Attributes:
Name | Type | Description |
---|---|---|
model |
object
|
The model object or weights received. |
weight |
float
|
The weight or importance of the update. |
source |
str
|
Identifier of the node that sent the update. |
round |
int
|
Training round this update belongs to. |
time_received |
float
|
Timestamp when the update was received. |
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
__eq__(other)
¶
Checks if two updates belong to the same round.
Source code in nebula/core/aggregation/updatehandlers/cflupdatehandler.py
33 34 35 36 37 |
|