service
dev_tool.services.scheduler.service
log = logging.getLogger(__name__)
module-attribute
SchedulerService
Bases: BaseService
A service class for task scheduling operations.
This class provides methods for scheduling, cancelling, and managing time-based tasks with persistence support.
The constructor for the SchedulerService class.
Parameters:
-
sqlite(SQLiteDatabase | None, default:None) –The SQLite database for task persistence.
Source code in dev_tool/services/scheduler/service.py
sqlite = sqlite
instance-attribute
cancel_task
A method that cancels a scheduled task.
Parameters:
-
name(str) –The name of the task to cancel.
Returns:
-
bool–True if the task was cancelled, False if not found.
Raises:
-
TaskCancellationError–If task cancellation fails.
Source code in dev_tool/services/scheduler/service.py
schedule_task
A method that schedules a task to run after a specified delay.
Parameters:
-
name(str) –The name of the task.
-
task(Callable[[], None]) –The function to execute.
-
seconds(float) –The delay in seconds before execution.
-
persist(bool, default:False) –Whether to persist the task across application restarts.
Raises:
-
TaskSchedulingError–If task scheduling fails.
Source code in dev_tool/services/scheduler/service.py
time_remaining
A method that gets the remaining time before a task executes.
Parameters:
-
name(str) –The name of the task to check.
Returns:
-
float | None–The remaining time in seconds, or None if not found.