crython/tab

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

class crython.tab.CronTab(*args, **kwargs)

Background thread responsible for executing background jobs.

register(name, job)

Register the given name and function.

Parameters:
  • name – Name of the registered job. Note: This should be unique.
  • job – Callable decorated with job() to execute.
Returns:

None.

deregister(name)

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

Parameters:name – Name of the job to remove.
Returns:None.
stop()

Stop this background thread from executing any more jobs.

Returns:None.
run()

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

crython.tab.default_tab

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

crython.tab.start()

Start the default, global CronTab instance.

crython.tab.stop()

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().