List all tasks in the scheduler with their types
(self, input: Input, request: Request)
| 7 | |
| 8 | class SchedulerTasksList(ApiHandler): |
| 9 | async def process(self, input: Input, request: Request) -> Output: |
| 10 | """ |
| 11 | List all tasks in the scheduler with their types |
| 12 | """ |
| 13 | try: |
| 14 | # Get timezone from input (do not set if not provided, we then rely on poll() to set it) |
| 15 | if timezone := input.get("timezone", None): |
| 16 | Localization.get().set_timezone(timezone) |
| 17 | |
| 18 | # Get task scheduler |
| 19 | scheduler = TaskScheduler.get() |
| 20 | await scheduler.reload() |
| 21 | |
| 22 | # Use the scheduler's convenience method for task serialization |
| 23 | tasks_list = scheduler.serialize_all_tasks() |
| 24 | |
| 25 | return {"ok": True, "tasks": tasks_list} |
| 26 | |
| 27 | except Exception as e: |
| 28 | PrintStyle.error(f"Failed to list tasks: {str(e)} {traceback.format_exc()}") |
| 29 | return {"ok": False, "error": f"Failed to list tasks: {str(e)} {traceback.format_exc()}", "tasks": []} |
nothing calls this directly
no test coverage detected