Documentation for Sacommand Module¶
AggregationCommand
¶
Bases: SACommand
Commands related to data aggregation.
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
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 |
|
conflicts_with(other)
async
¶
Determines if two commands conflict with each other.
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
ConnectivityCommand
¶
Bases: SACommand
Commands related to connectivity.
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
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 |
|
conflicts_with(other)
async
¶
Determines if two commands conflict with each other.
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
execute()
async
¶
Executes the assigned action function with the given parameters.
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
167 168 169 170 171 172 173 174 |
|
SACommand
¶
Base class for Situational Awareness (SA) module commands.
This class defines the core structure and behavior of commands that can be issued by SA agents. Each command has an associated type, action, target, priority, and execution state. Commands may also declare whether they can be executed in parallel. Subclasses must implement the actual logic for execution and conflict detection.
Attributes:
Name | Type | Description |
---|---|---|
command_type |
SACommandType
|
Type of the command (e.g., parameter update, structural change). |
action |
SACommandAction
|
Specific action the command performs. |
owner |
SAModuleAgent
|
Reference to the module or agent that issued the command. |
target |
Any
|
Target of the command (e.g., node, parameter name). |
priority |
SACommandPRIO
|
Priority level of the command. |
parallelizable |
bool
|
Indicates whether the command can be run concurrently. |
_state |
SACommandState
|
Internal state of the command (e.g., PENDING, DISCARDED). |
_state_future |
Future
|
Future that resolves when the command changes state. |
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
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 |
|
conflicts_with(other)
abstractmethod
async
¶
Determine whether this command conflicts with another command.
This method must be implemented by subclasses to define conflict logic, e.g., whether two commands target the same resource in incompatible ways. Used during arbitration to resolve simultaneous command suggestions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
SACommand
|
Another command instance to check for conflicts. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if there is a conflict, False otherwise. |
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
execute()
abstractmethod
async
¶
Execute the command's action on the specified target.
This method must be implemented by subclasses to define the actual logic of how the command affects the system. It may involve sending messages, modifying local or global state, or interacting with external components.
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
84 85 86 87 88 89 90 91 92 93 |
|
SACommandState
¶
Bases: Enum
Source code in nebula/core/situationalawareness/awareness/sautils/sacommand.py
34 35 36 37 38 39 40 41 42 |
|