Documentation for Nebulaevents Module¶
AggregationEvent
¶
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 131 132 133 134 135 136 137 |
|
__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
106 107 108 109 110 111 112 113 114 115 116 |
|
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
125 126 127 128 129 130 131 132 133 134 |
|
update_updates(new_updates)
¶
Allows an external module to update the updates dictionary.
Source code in nebula/core/nebulaevents.py
121 122 123 |
|
BeaconRecievedEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 279 |
|
__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
253 254 255 256 257 258 259 260 261 262 |
|
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
267 268 269 270 271 272 273 274 275 276 |
|
ExperimentFinishEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
__init__()
¶
Event triggered when experiment is going to finish.
Source code in nebula/core/nebulaevents.py
91 92 93 |
|
NodeFoundEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
__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
189 190 191 192 193 194 195 |
|
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
200 201 202 203 204 205 206 207 |
|
RoundEndEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__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
63 64 65 66 67 68 69 70 71 |
|
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
76 77 78 79 80 81 82 83 84 |
|
RoundStartEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
__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
34 35 36 37 38 39 40 41 42 43 |
|
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
48 49 50 51 52 53 54 55 56 |
|
UpdateNeighborEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__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
141 142 143 144 145 146 147 148 149 150 151 |
|
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
156 157 158 159 160 161 162 163 164 |
|
UpdateReceivedEvent
¶
Bases: NodeEvent
Source code in nebula/core/nebulaevents.py
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 |
|
__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
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
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
234 235 236 237 238 239 240 241 242 243 244 245 246 |
|