Add a Task implementation to the dispatch registry. Idempotent — re-registering the same name is a no-op. (Useful for test reloads.)
(task: Task)
| 187 | |
| 188 | |
| 189 | def register_task(task: Task) -> None: |
| 190 | """Add a Task implementation to the dispatch registry. |
| 191 | |
| 192 | Idempotent — re-registering the same name is a no-op. (Useful for |
| 193 | test reloads.) |
| 194 | """ |
| 195 | for existing in _REGISTERED_TASKS: |
| 196 | if existing.name == task.name and existing.type == task.type: |
| 197 | return |
| 198 | _REGISTERED_TASKS.append(task) |
| 199 | |
| 200 | |
| 201 | def get_all_tasks() -> list[Task]: |