Commit 0716aee
Feature/port scheduling and magic entity resolution (#398)
* Add get_port and schedule_port functions
- Add get_port(identifier, identifier_type) for retrieving ports by ID or name
- Add schedule_port(port, scheduled) following schedule_processor pattern
- Register PortEntity in config.py for filter_obj support
- Add comprehensive tests for both functions
* fix(canvas): Set controller name in initial creation request
Previously create_controller() set the name in a separate update call
after creation, but returned the stale object from the initial call.
This caused component.name to show the type name instead of the custom
name.
Now sets name directly in the ControllerServiceDTO during creation,
matching the pattern used by create_processor(). Also defaults to
short type name if no name provided (e.g., 'JsonTreeReader').
* WIP: Add scheduling state consolidation utilities
Utilities implemented in nipyapi/utils.py:
- resolve_schedule_state(): Standardized bool/string to state normalization
- resolve_entity(): Entity resolution accepting ID, name, or object
(to be used in next phase)
Scheduling functions consolidated in canvas.py:
- schedule_processor: Uses resolve_schedule_state()
- schedule_port: Uses resolve_schedule_state()
- schedule_controller: Uses resolve_schedule_state(), now accepts string
states ('ENABLED', 'DISABLED') in addition to bool
- schedule_all_controllers: Same extension
- schedule_components: Now accepts string states ('RUNNING', 'STOPPED')
Breaking change: Invalid scheduled values now raise ValueError instead
of AssertionError. This is a more appropriate exception type.
Tests expanded for new string state acceptance in controller scheduling.
All 660 tests pass.
* feat: Add resolve_entity utility for consistent entity resolution across modules
- Add resolve_entity() and resolve_schedule_state() utilities in utils.py
- Refactor 17 canvas.py functions to accept object, ID, or name
- Refactor 9 versioning.py functions with consistent entity resolution
- Refactor 5 parameters.py functions with consistent entity resolution
- Add schedule_port() and get_port() functions to canvas.py
- Add greedy parameter to get_controller()
- Remove deprecated get_variable_registry/update_variable_registry
- Consolidate verification request pattern with _run_verification_request helper
- Make location optional in create_process_group and create_funnel
- Add PortEntity to registered_filters in config.py
- Optimize fix_state_flow fixture to module scope
- Update tests for new ValueError exceptions and expanded functionality
Closes #396
* Add Raises sections to entity resolution function docstrings
* docs: Clarify test comment about ValueError from resolve_entity validation (#399)
* Initial plan
* docs: Clarify test comment about ValueError from resolve_entity validation
Co-authored-by: Chaffelson <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Chaffelson <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Chaffelson <[email protected]>1 parent c4127de commit 0716aee
File tree
10 files changed
+1642
-434
lines changed- nipyapi
- tests
10 files changed
+1642
-434
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
| 187 | + | |
187 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
191 | 199 | | |
192 | 200 | | |
193 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
194 | 209 | | |
195 | 210 | | |
196 | 211 | | |
| |||
218 | 233 | | |
219 | 234 | | |
220 | 235 | | |
221 | | - | |
| 236 | + | |
222 | 237 | | |
223 | 238 | | |
| 239 | + | |
224 | 240 | | |
225 | | - | |
| 241 | + | |
| 242 | + | |
226 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
227 | 247 | | |
228 | 248 | | |
229 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
230 | 254 | | |
231 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
232 | 264 | | |
233 | 265 | | |
234 | 266 | | |
235 | 267 | | |
236 | | - | |
| 268 | + | |
237 | 269 | | |
238 | 270 | | |
239 | 271 | | |
240 | 272 | | |
241 | | - | |
242 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
243 | 279 | | |
244 | 280 | | |
245 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
246 | 286 | | |
247 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
248 | 296 | | |
249 | 297 | | |
250 | 298 | | |
251 | 299 | | |
252 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
253 | 303 | | |
254 | 304 | | |
255 | 305 | | |
256 | 306 | | |
257 | 307 | | |
258 | | - | |
| 308 | + | |
| 309 | + | |
259 | 310 | | |
260 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
261 | 315 | | |
262 | 316 | | |
263 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
264 | 322 | | |
265 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
266 | 332 | | |
267 | 333 | | |
268 | 334 | | |
| |||
275 | 341 | | |
276 | 342 | | |
277 | 343 | | |
278 | | - | |
| 344 | + | |
279 | 345 | | |
280 | 346 | | |
281 | 347 | | |
282 | 348 | | |
283 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
284 | 354 | | |
285 | 355 | | |
286 | 356 | | |
287 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
288 | 370 | | |
289 | 371 | | |
290 | 372 | | |
| |||
0 commit comments