Package turbogears :: Module scheduler

Module scheduler

source code

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 could use one of the following Task classes
and use schedule_task or schedule_task_abs:
    IntervalTask    ThreadedIntervalTask    ForkedIntervalTask
    WeekdayTask     ThreadedWeekdayTask     ForkedWeekdayTask
    MonthdayTask    ThreadedMonthdayTask    ForkedMonthdayTask

Kronos is the Greek God of Time.

This module is based on Kronos by Irmen de Jong, but has been modified
to better fit within TurboGears. Additionally, this module appeared to
no longer be supported/in development.

Classes
  Scheduler
The Scheduler itself.
  Task
Abstract base class of all scheduler tasks
  IntervalTask
A repeated task that occurs at certain intervals (in seconds).
  DayTaskRescheduler
A mixin class that contains the reschedule logic for the DayTasks.
  WeekdayTask
A task that is called at specific days in a week (1-7), at a fixed time on the day.
  MonthdayTask
A task that is called at specific days in a month (1-31), at a fixed time on the day.
  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.
  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.
  ForkedWeekdayTask
Weekday Task that executes in its own process.
  ForkedMonthdayTask
Monthday Task that executes in its own process.
Functions
 
add_interval_task(action, interval, args=None, kw=None, initialdelay=0, processmethod=threaded, taskname=None) source code
 
add_weekday_task(action, weekdays, timeonday, args=None, kw=None, processmethod=threaded, taskname=None) source code
 
add_monthday_task(action, monthdays, timeonday, args=None, kw=None, processmethod=threaded, taskname=None) source code
 
cancel(task) source code
Variables
  method = Enum('sequential', 'forked', 'threaded')