File size: 1,084 Bytes
345855e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 42 43 44 45 | from core.registry.tasks_registry import TASKS
# ------------------------------------------------
# Return categorized tasks (UI Builder uses this)
# ------------------------------------------------
def get_tasks():
return TASKS
# ------------------------------------------------
# Flatten tasks across categories
# ------------------------------------------------
def get_all_tasks():
tasks = []
for category, items in TASKS.items():
for task in items:
task_copy = dict(task)
task_copy["category"] = category
tasks.append(task_copy)
return tasks
# ------------------------------------------------
# Execution map
# id -> callable
# ------------------------------------------------
def get_task_map():
task_map = {}
for category, items in TASKS.items():
for task in items:
if "handler" not in task:
raise RuntimeError(
f"Task '{task['id']}' missing handler"
)
task_map[task["id"]] = task["handler"]
return task_map |