The cinder.openstack.common.periodic_task Module

exception InvalidPeriodicTaskArg

Bases: exceptions.Exception

message = u'Unexpected argument for periodic task creation: %(arg)s.'
class PeriodicTasks

Bases: object

add_periodic_task(task)

Add a periodic task to the list of periodic tasks.

The task should already be decorated by @periodic_task.

run_periodic_tasks(context, raise_on_error=False)

Tasks to be run at a periodic interval.

list_opts()

Entry point for oslo.config-generator.

periodic_task(*args, **kwargs)

Decorator to indicate that a method is a periodic task.

This decorator can be used in two ways:

  1. Without arguments '@periodic_task‘, this will be run on the default interval of 60 seconds.
  2. With arguments: @periodic_task(spacing=N [, run_immediately=[True|False]] [, name=[None|”string”]) this will be run on approximately every N seconds. If this number is negative the periodic task will be disabled. If the run_immediately argument is provided and has a value of ‘True’, the first run of the task will be shortly after task scheduler starts. If run_immediately is omitted or set to ‘False’, the first time the task runs will be approximately N seconds after the task scheduler starts. If name is not provided, __name__ of function is used.

Previous topic

The cinder.openstack.common.middleware.request_id Module

Next topic

The cinder.openstack.common.policy Module

This Page