Contains functionality for executing jobs (python functions) from cron expressions.

class*args, **kwargs)

Background thread responsible for executing background jobs.

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

register(name, job)

Register the given name and function.

  • name – Name of the registered job. Note: This should be unique.

  • job – Callable decorated with job() to execute.




De-register the job that was registered with the given name.


name – Name of the job to remove.




Stop this background thread from executing any more jobs.




Background function that processes all registered jobs and invokes them based on their context and expression.

The default, global tab instance that is created on import. This is the instance that will be used unless the job() caller overrides it.

Start the default, global CronTab instance.

Stop the default, global CronTab instance.

This informs the background thread to stop processing new jobs but does not wait for it to finish completing its current ones. If the caller wishes to wait for the thread to stop completely, it should call join().