symfonic.agent.scheduler¶
scheduler ¶
InProcessScheduler -- lightweight asyncio-based task scheduler.
Runs tasks in the current event loop with no persistence and no external dependencies. For production use, replace with a real scheduler (Celery, APScheduler, etc.).
InProcessScheduler ¶
Lightweight asyncio-based task scheduler.
Runs tasks in the current event loop. No persistence, no external dependencies. For production, replace with a real scheduler (Celery, APScheduler, etc.).
Source code in src/symfonic/agent/scheduler.py
cancel
async
¶
Cancel a scheduled task by name.
Returns True if the task existed and was cancelled.
list_tasks
async
¶
List all scheduled tasks with status.
Source code in src/symfonic/agent/scheduler.py
schedule_interval
async
¶
schedule_interval(
name: str,
coro_factory: Callable[[], Awaitable[Any]],
interval_seconds: float,
) -> None
Schedule a coroutine to run repeatedly at a fixed interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique task identifier. |
required |
coro_factory
|
Callable[[], Awaitable[Any]]
|
Zero-arg callable that returns a fresh awaitable on each invocation. |
required |
interval_seconds
|
float
|
Seconds between successive executions. |
required |
Source code in src/symfonic/agent/scheduler.py
schedule_once
async
¶
Schedule a coroutine to run once after an optional delay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique task identifier. Cancels any existing task with the same name before scheduling. |
required |
coro
|
Awaitable[Any]
|
Awaitable to execute. |
required |
delay_seconds
|
float
|
Seconds to wait before execution (default 0). |
0
|
Source code in src/symfonic/agent/scheduler.py
shutdown
async
¶
Cancel all tasks and mark the scheduler as stopped.