Documentation for Nebulaevents Module¶
AddonEvent
¶
Bases: ABC
Abstract base class for all addon-related events in the system.
Source code in nebula/core/nebulaevents.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
get_event_data()
abstractmethod
async
¶
Retrieve the data associated with the event.
Returns:
Name | Type | Description |
---|---|---|
Any |
The event-specific data payload. |
Source code in nebula/core/nebulaevents.py
9 10 11 12 13 14 15 16 17 |
|
AggregationEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__init__(updates, expected_nodes, missing_nodes)
¶
Event triggered when model aggregation is ready.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
updates
|
dict
|
Dictionary containing model updates. |
required |
expected_nodes
|
set
|
Set of nodes expected to participate in aggregation. |
required |
missing_nodes
|
set
|
Set of nodes that did not send their update. |
required |
Source code in nebula/core/nebulaevents.py
148 149 150 151 152 153 154 155 156 157 158 |
|
get_event_data()
async
¶
Retrieves the aggregation event data.
Returns:
Type | Description |
---|---|
tuple[dict, set, set]
|
tuple[dict, set, set]: - updates (dict): Model updates. - expected_nodes (set): Expected nodes. - missing_nodes (set): Missing nodes. |
Source code in nebula/core/nebulaevents.py
167 168 169 170 171 172 173 174 175 176 |
|
update_updates(new_updates)
¶
Allows an external module to update the updates dictionary.
Source code in nebula/core/nebulaevents.py
163 164 165 |
|
BeaconRecievedEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
|
__init__(source, geoloc)
¶
Initializes an BeaconRecievedEvent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
str
|
The received beacon source. |
required |
geoloc
|
tuple
|
The geolocalzition associated with the received beacon source. |
required |
Source code in nebula/core/nebulaevents.py
338 339 340 341 342 343 344 345 346 347 |
|
get_event_data()
async
¶
Retrieves the event data.
Returns:
Type | Description |
---|---|
tuple[str, tuple[float, float]]
|
tuple[str, tuple[float, float]]: A tuple containing: - The beacon's source. - the device geolocalization (latitude, longitude). |
Source code in nebula/core/nebulaevents.py
352 353 354 355 356 357 358 359 360 361 |
|
ChangeLocationEvent
¶
Bases: AddonEvent
Event used to signal a change in the node's geographical location.
Attributes:
Name | Type | Description |
---|---|---|
latitude |
float
|
New latitude of the node. |
longitude |
float
|
New longitude of the node. |
Source code in nebula/core/nebulaevents.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
|
__init__(latitude, longitude)
¶
Initializes a ChangeLocationEvent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
latitude
|
float
|
The new latitude value. |
required |
longitude
|
float
|
The new longitude value. |
required |
Source code in nebula/core/nebulaevents.py
431 432 433 434 435 436 437 438 439 440 |
|
get_event_data()
async
¶
Returns the new location coordinates associated with this event.
Returns:
Name | Type | Description |
---|---|---|
tuple |
A tuple containing latitude and longitude. |
Source code in nebula/core/nebulaevents.py
445 446 447 448 449 450 451 452 |
|
DuplicatedMessageEvent
¶
Bases: NodeEvent
Event triggered when a message is received that has already been processed.
Attributes:
Name | Type | Description |
---|---|---|
source |
str
|
The address of the node that sent the duplicated message. |
Source code in nebula/core/nebulaevents.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
ExperimentFinishEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
133 134 135 136 137 138 139 140 141 142 143 144 |
|
__init__()
¶
Event triggered when experiment is going to finish.
Source code in nebula/core/nebulaevents.py
134 135 |
|
GPSEvent
¶
Bases: AddonEvent
Event triggered by a GPS module providing distance data between nodes.
Attributes:
Name | Type | Description |
---|---|---|
distances |
dict
|
A dictionary mapping node addresses to their respective distances. |
Source code in nebula/core/nebulaevents.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
|
__init__(distances)
¶
Initializes a GPSEvent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
distances
|
dict
|
Dictionary of distances from the current node to others. |
required |
Source code in nebula/core/nebulaevents.py
400 401 402 403 404 405 406 407 |
|
get_event_data()
async
¶
Returns the distance data associated with this event.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A copy of the distances dictionary. |
Source code in nebula/core/nebulaevents.py
412 413 414 415 416 417 418 419 |
|
MessageEvent
¶
Event class for wrapping received messages in the system.
Attributes:
Name | Type | Description |
---|---|---|
message_type |
str
|
Type/category of the message. |
source |
str
|
Address or identifier of the message sender. |
message |
Any
|
The actual message payload. |
Source code in nebula/core/nebulaevents.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
__init__(message_type, source, message)
¶
Initializes a MessageEvent instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message_type
|
str
|
Type/category of the message. |
required |
source
|
str
|
Address or identifier of the message sender. |
required |
message
|
Any
|
The actual message payload. |
required |
Source code in nebula/core/nebulaevents.py
56 57 58 59 60 61 62 63 64 65 66 67 |
|
ModelPropagationEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
__init__(eligible_neighbors, strategy)
¶
Event triggered when model propagation is ready.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
eligible_neighbors
|
set
|
The elegible neighbors to propagate model. |
required |
strategy
|
str
|
Strategy to propagete the model |
required |
Source code in nebula/core/nebulaevents.py
269 270 271 272 273 274 275 276 277 |
|
get_event_data()
async
¶
Retrieves the event data.
Returns:
Type | Description |
---|---|
tuple[set, str]
|
tuple[set, str]: A tuple containing: - The elegible neighbors to propagate model. - The propagation strategy. |
Source code in nebula/core/nebulaevents.py
282 283 284 285 286 287 288 289 290 291 |
|
NodeBlacklistedEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__init__(node_addr, blacklisted=False)
¶
Initializes a NodeBlacklistedEvent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_addr
|
str
|
The address of the node. |
required |
blacklisted
|
bool
|
True if the node is blacklisted, False if it's just marked as recently disconnected. |
False
|
Source code in nebula/core/nebulaevents.py
216 217 218 219 220 221 222 223 224 225 226 |
|
get_event_data()
async
¶
Retrieves the address of the node and its blacklist status.
Returns:
Type | Description |
---|---|
tuple[str, bool]
|
tuple[str, bool]: A tuple containing the node address and blacklist flag. |
Source code in nebula/core/nebulaevents.py
231 232 233 234 235 236 237 238 |
|
NodeEvent
¶
Bases: ABC
Abstract base class for all node-related events in the system.
Source code in nebula/core/nebulaevents.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
get_event_data()
abstractmethod
async
¶
Retrieve the data associated with the event.
Returns:
Name | Type | Description |
---|---|---|
Any |
The event-specific data payload. |
Source code in nebula/core/nebulaevents.py
25 26 27 28 29 30 31 32 33 |
|
is_concurrent()
abstractmethod
async
¶
Indicates whether the event can be handled concurrently.
Returns:
Name | Type | Description |
---|---|---|
bool |
True if concurrent handling is allowed, False otherwise. |
Source code in nebula/core/nebulaevents.py
35 36 37 38 39 40 41 42 43 |
|
NodeFoundEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
__init__(node_addr)
¶
Event triggered when a new node is found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_addr
|
str
|
Address of the neighboring node. |
required |
Source code in nebula/core/nebulaevents.py
245 246 247 248 249 250 251 |
|
get_event_data()
async
¶
Retrieves the node found event data.
Returns:
Type | Description |
---|---|
tuple[str, bool]
|
tuple[str, bool]: - node_addr (str): Address of the node found. |
Source code in nebula/core/nebulaevents.py
256 257 258 259 260 261 262 263 |
|
RoundEndEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__init__(round, end_time)
¶
Event triggered when round is going to start.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
round
|
int
|
Round number. |
required |
end_time
|
time
|
Current time when round has ended. |
required |
Source code in nebula/core/nebulaevents.py
106 107 108 109 110 111 112 113 114 |
|
get_event_data()
async
¶
Retrieves the round start event data.
Returns:
Type | Description |
---|---|
tuple[int, float]: -round (int): Round number. -end_time (time): Current time when round has ended. |
Source code in nebula/core/nebulaevents.py
119 120 121 122 123 124 125 126 127 |
|
RoundStartEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__init__(round, start_time, expected_nodes)
¶
Event triggered when round is going to start.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
round
|
int
|
Round number. |
required |
start_time
|
time
|
Current time when round is going to start. |
required |
Source code in nebula/core/nebulaevents.py
77 78 79 80 81 82 83 84 85 86 |
|
get_event_data()
async
¶
Retrieves the round start event data.
Returns:
Type | Description |
---|---|
tuple[int, float]: -round (int): Round number. -start_time (time): Current time when round is going to start. |
Source code in nebula/core/nebulaevents.py
91 92 93 94 95 96 97 98 99 |
|
UpdateNeighborEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__init__(node_addr, removed=False, joining=False)
¶
Event triggered when a neighboring node is updated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_addr
|
str
|
Address of the neighboring node. |
required |
removed
|
bool
|
Indicates whether the node was removed. Defaults to False. |
False
|
Source code in nebula/core/nebulaevents.py
183 184 185 186 187 188 189 190 191 192 193 |
|
get_event_data()
async
¶
Retrieves the neighbor update event data.
Returns:
Type | Description |
---|---|
tuple[str, bool]
|
tuple[str, bool]: - node_addr (str): Address of the neighboring node. - removed (bool): Whether the node was removed. |
Source code in nebula/core/nebulaevents.py
198 199 200 201 202 203 204 205 206 |
|
UpdateReceivedEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
__init__(decoded_model, weight, source, round, local=False)
¶
Initializes an UpdateReceivedEvent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
decoded_model
|
Any
|
The received model update. |
required |
weight
|
float
|
The weight associated with the received update. |
required |
source
|
str
|
The identifier or address of the node that sent the update. |
required |
round
|
int
|
The round number in which the update was received. |
required |
local
|
bool
|
Local update |
False
|
Source code in nebula/core/nebulaevents.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
get_event_data()
async
¶
Retrieves the event data.
Returns:
Type | Description |
---|---|
tuple[object, int, str, int, bool]
|
tuple[Any, float, str, int, bool]: A tuple containing: - The received model update. - The weight associated with the update. - The source node identifier. - The round number of the update. - If the update is local |
Source code in nebula/core/nebulaevents.py
319 320 321 322 323 324 325 326 327 328 329 330 331 |
|