Commit 3407a12
authored
fix: stomp-py 6.x callback arg-shape + DRY consolidation across gridappsd-python (#210)
Root cause: stomp-py 6.0.0 (the pinned/installed version) invokes raw
stomp listener callbacks with two positional args (headers, body), but
several goss.py call sites assumed the stomp-py 8.x single Frame object
shape (frame.headers / frame.body). At argument unpack time this called
.headers on the headers dict, raising AttributeError: 'dict' object has
no attribute 'headers'. This broke the simulation integration tests,
surfacing downstream as a 30 second query_model_info TimeoutError, and
was masked in CI by continue-on-error on the sim step.
Fix: a single _unpack_stomp_args() helper now handles both the stomp 6
two-arg shape and the stomp 8 Frame shape, applied at all 6 former call
sites in goss.py. A companion _serialize_message() helper centralizes
dict/list to JSON serialization.
Additional DRY consolidations included in this PR:
- simulation.py: _send_simulation_command() consolidates the pause,
stop, and resume command methods into one helper.
- gridappsd.py: _set_status() consolidates the application and service
status setter methods.
- timeseries.py: a single query filter helper replaces duplicated filter
methods.
- app_registration.py: ApplicationStatusEnum replaces duplicated
environment writes for GRIDAPPSD_APPLICATION_STATUS.
Test results: 51 pytest tests passed, ruff clean. Two pre-existing mypy
errors remain in simulation.py (SimulationArgs.publish_period and
interval typed int but defaulted None); these are unrelated to this
change and are tracked in #208.
Closes #207
Closes #208.
Related follow-up: #209 tracks sharing the _unpack_stomp_args helper
with gridappsd-field-bus-lib, which has its own duplicate of the same
stomp arg-shape branch. That work is out of scope for this PR.
Related: #208 (pre-existing mypy type issue in simulation.py, not fixed
by this PR).10 files changed
Lines changed: 562 additions & 323 deletions
File tree
- gridappsd-python-lib
- gridappsd
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
17 | 42 | | |
18 | 43 | | |
19 | 44 | | |
| |||
35 | 60 | | |
36 | 61 | | |
37 | 62 | | |
38 | | - | |
| 63 | + | |
39 | 64 | | |
40 | 65 | | |
41 | 66 | | |
42 | 67 | | |
43 | 68 | | |
44 | | - | |
| 69 | + | |
45 | 70 | | |
46 | 71 | | |
47 | 72 | | |
48 | | - | |
| 73 | + | |
49 | 74 | | |
50 | 75 | | |
51 | | - | |
| 76 | + | |
52 | 77 | | |
53 | 78 | | |
54 | 79 | | |
| |||
58 | 83 | | |
59 | 84 | | |
60 | 85 | | |
61 | | - | |
| 86 | + | |
62 | 87 | | |
63 | 88 | | |
64 | 89 | | |
| |||
80 | 105 | | |
81 | 106 | | |
82 | 107 | | |
83 | | - | |
| 108 | + | |
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
| |||
119 | 144 | | |
120 | 145 | | |
121 | 146 | | |
122 | | - | |
| 147 | + | |
123 | 148 | | |
124 | 149 | | |
125 | 150 | | |
| |||
160 | 185 | | |
161 | 186 | | |
162 | 187 | | |
163 | | - | |
| 188 | + | |
164 | 189 | | |
165 | 190 | | |
166 | 191 | | |
| |||
176 | 201 | | |
177 | 202 | | |
178 | 203 | | |
179 | | - | |
| 204 | + | |
180 | 205 | | |
181 | 206 | | |
182 | 207 | | |
183 | 208 | | |
184 | | - | |
| 209 | + | |
185 | 210 | | |
186 | 211 | | |
187 | 212 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| |||
66 | 65 | | |
67 | 66 | | |
68 | 67 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 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 | + | |
82 | 103 | | |
83 | 104 | | |
84 | 105 | | |
| |||
168 | 189 | | |
169 | 190 | | |
170 | 191 | | |
171 | | - | |
172 | | - | |
| 192 | + | |
173 | 193 | | |
174 | 194 | | |
175 | 195 | | |
| |||
185 | 205 | | |
186 | 206 | | |
187 | 207 | | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
| 208 | + | |
| 209 | + | |
193 | 210 | | |
194 | 211 | | |
195 | 212 | | |
| |||
198 | 215 | | |
199 | 216 | | |
200 | 217 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
| 218 | + | |
206 | 219 | | |
207 | 220 | | |
208 | 221 | | |
| |||
216 | 229 | | |
217 | 230 | | |
218 | 231 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 232 | + | |
224 | 233 | | |
225 | 234 | | |
226 | 235 | | |
| |||
337 | 346 | | |
338 | 347 | | |
339 | 348 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
| 349 | + | |
345 | 350 | | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
349 | 354 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
| 355 | + | |
355 | 356 | | |
356 | 357 | | |
357 | 358 | | |
| |||
404 | 405 | | |
405 | 406 | | |
406 | 407 | | |
407 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
408 | 411 | | |
409 | | - | |
410 | 412 | | |
411 | 413 | | |
412 | 414 | | |
| |||
429 | 431 | | |
430 | 432 | | |
431 | 433 | | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
| 434 | + | |
437 | 435 | | |
438 | 436 | | |
439 | 437 | | |
| |||
442 | 440 | | |
443 | 441 | | |
444 | 442 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 443 | + | |
450 | 444 | | |
451 | 445 | | |
452 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
131 | 139 | | |
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
135 | 143 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 144 | + | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| |||
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
154 | 161 | | |
155 | 162 | | |
156 | | - | |
| 163 | + | |
157 | 164 | | |
158 | 165 | | |
159 | 166 | | |
| |||
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
166 | | - | |
| 173 | + | |
167 | 174 | | |
168 | 175 | | |
169 | 176 | | |
| |||
0 commit comments