Home | Trees | Indices | Help |
|
---|
|
Module that provides a cron-like task scheduler. This task scheduler is designed to be used from inside your own program. You can schedule Python functions to be called at specific intervals or days. It uses the standard 'sched' module for the actual task scheduling, but provides much more: * repeated tasks (at intervals, or on specific days) * error handling (exceptions in tasks don't kill the scheduler) * optional to run scheduler in its own thread or separate process * optional to run a task in its own thread or separate process If the threading module is available, you can use the various Threaded variants of the scheduler and associated tasks. If threading is not available, you could still use the forked variants. If fork is also not available, all processing is done in a single process, sequentially. There are three Scheduler classes: Scheduler ThreadedScheduler ForkedScheduler You usually add new tasks to a scheduler using the add_interval_task or add_daytime_task methods, with the appropriate processmethod argument to select sequential, threaded or forked processing. NOTE: it is impossible to add new tasks to a ForkedScheduler, after the scheduler has been started! For more control you can use one of the following Task classes and use schedule_task or schedule_task_abs: IntervalTask ThreadedIntervalTask ForkedIntervalTask SingleTask ThreadedSingleTask ForkedSingleTask WeekdayTask ThreadedWeekdayTask ForkedWeekdayTask CronLikeTask ThreadedCronLikeTask ForkedCronLikeTask Kronos is the Greek god of time. Kronos scheduler (c) by Irmen de Jong. This module is based on the Kronos scheduler by Irmen de Jong, but has been modified to better fit within TurboGears. Vince Spicer and Mathieu Bridon have contributed some additions and improvements such as cron-like tasks. Some fixes have been made to make it work on Python 2.6 (adaptations sched module changes).
Version: 2.0
Classes | |
Scheduler The Scheduler itself. |
|
Task Abstract base class of all scheduler tasks |
|
SingleTask A task that only runs once. |
|
IntervalTask A repeated task that occurs at certain intervals (in seconds). |
|
WeekdayTask A task that is run on a given weekday. |
|
MonthdayTask A task that is run on a given day every month. |
|
ThreadedScheduler A Scheduler that runs in its own thread. |
|
ThreadedTaskMixin A mixin class to make a Task execute in a separate thread. |
|
ThreadedIntervalTask Interval Task that executes in its own thread. |
|
ThreadedSingleTask Single Task that executes in its own thread. |
|
ThreadedWeekdayTask Weekday Task that executes in its own thread. |
|
ThreadedMonthdayTask Monthday Task that executes in its own thread. |
|
ForkedScheduler A Scheduler that runs in its own forked process. |
|
ForkedTaskMixin A mixin class to make a Task execute in a separate process. |
|
ForkedIntervalTask Interval Task that executes in its own process. |
|
ForkedSingleTask Single Task that executes in its own process. |
|
ForkedWeekdayTask Weekday Task that executes in its own process. |
|
ForkedMonthdayTask Monthday Task that executes in its own process. |
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
method = Enum('sequential', 'forked', 'threaded')
|
Function Details |
Add an interval task to the scheduler. Pass in initialdelay with a number of seconds to wait before running and an interval with the number of seconds between runs. For example, an initialdelay of 600 and interval of 60 would mean "start running after 10 minutes and run every 1 minute after that".
|
Add a single task to the scheduler. Runs a task once. Pass in ``initialdelay`` with a number of seconds to wait before running.
|
Add a weekday task to the scheduler. Runs on certain days of the week. Pass in a list or tuple of weekdays from 1-7 (where 1 is Monday). Additionally, you need to pass in timeonday which is the time of day to run. timeonday should be a tuple with (hour, minute).
|
Add a monthly task to the scheduler. Runs on certain days of the month. Pass in a list or tuple of monthdays from 1-31, import and also pass in timeonday which is an (hour, minute) tuple of the time of day to run the task. @param monthdays: list ot tuple of monthdays to execute action @param timeonday: tuple (hour, minute), to run on monthday @param action: The callable that will be called at the time you request @param args: Tuple of positional parameters to pass to the action @param kw: Keyword arguments to pass to the action @param taskname: Tasks can have a name (stored in task.name), which can help if you're trying to keep track of many tasks. @param precessmethod: By default, each task will be run in a new thread. You can also pass in turbogears.scheduler.method.sequential or turbogears.scheduler.method.forked. |
Cancel task by task name.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jul 19 17:17:55 2019 | http://epydoc.sourceforge.net |