---------------------------------------------------------------------- This is the API documentation for the gdtest_skill_complex library. ---------------------------------------------------------------------- ## Classes Core classes Scheduler(workers: int = 1, name: str = 'default') Central task scheduler with worker pool. Parameters ---------- workers Number of concurrent worker threads. name Scheduler instance identifier. Task(name: str, fn=None, timeout: int | None = None) A unit of work managed by a Scheduler. Parameters ---------- name Task identifier (must be unique within a scheduler). fn Callable to execute. timeout Maximum execution time in seconds (None = no limit). CronExpr(expr: str) A parsed cron expression. Parameters ---------- expr Cron expression string (5 fields: min hour dom month dow). Raises ------ ValueError If the expression is malformed. TaskResult(task: gdtest_skill_complex.Task, status: str = 'pending', value=None, error: Exception | None = None) The result of a completed task. Parameters ---------- task The task that produced this result. status Execution status (pending, success, failed, timeout). value Return value from the task callable. error Exception if the task failed. ## Scheduler Methods Methods for the Scheduler class every(self, seconds: int, fn=None, name: str = '') -> 'Task' Schedule a recurring task at a fixed interval. Parameters ---------- seconds Interval in seconds between executions. fn Callable to execute. name Task identifier. Returns ------- Task The registered task. cron(self, expr: str, fn=None, name: str = '') -> 'Task' Schedule a task using a cron expression. Parameters ---------- expr Cron expression (e.g., ``*/5 * * * *``). fn Callable to execute. name Task identifier. Returns ------- Task The registered task. once(self, delay: int, fn=None, name: str = '') -> 'Task' Schedule a one-shot task after a delay. Parameters ---------- delay Delay in seconds before execution. fn Callable to execute. name Task identifier. Returns ------- Task The registered task. chain(self, *tasks: 'Task') -> list['TaskResult'] Execute tasks sequentially, passing each result to the next. Parameters ---------- *tasks Tasks to chain in order. Returns ------- list[TaskResult] Results from each task in the chain. submit(self, fn=None, name: str = '') -> 'Task' Submit a fire-and-forget task. Parameters ---------- fn Callable to execute. name Task identifier. Returns ------- Task The submitted task. run(self) -> list['TaskResult'] Start the scheduler and block until stopped. Returns ------- list[TaskResult] Results of all completed tasks. stop(self) -> None Stop the scheduler gracefully. ## Functions Public functions every(seconds: int, fn=None) -> gdtest_skill_complex.Task Module-level shortcut: schedule a recurring task. Parameters ---------- seconds Interval between executions. fn Callable to execute. Returns ------- Task The registered task. cron(expr: str, fn=None) -> gdtest_skill_complex.Task Module-level shortcut: schedule a cron task. Parameters ---------- expr Cron expression. fn Callable to execute. Returns ------- Task The registered task. once(delay: int, fn=None) -> gdtest_skill_complex.Task Module-level shortcut: schedule a one-shot task. Parameters ---------- delay Seconds before execution. fn Callable to execute. Returns ------- Task The registered task. chain(*tasks: gdtest_skill_complex.Task) -> list[gdtest_skill_complex.TaskResult] Module-level shortcut: chain tasks sequentially. Parameters ---------- *tasks Tasks to chain. Returns ------- list[TaskResult] Results from each task.