periodic_task¶
-
exception
oslo_service.periodic_task.
InvalidPeriodicTaskArg
¶ Bases:
Exception
-
message
= 'Unexpected argument for periodic task creation: %(arg)s.'¶
-
-
class
oslo_service.periodic_task.
PeriodicTasks
(conf)¶ 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.
-
-
oslo_service.periodic_task.
list_opts
()¶ Entry point for oslo-config-generator.
-
oslo_service.periodic_task.
periodic_task
(*args, **kwargs)¶ Decorator to indicate that a method is a periodic task.
This decorator can be used in two ways:
Without arguments ‘@periodic_task’, this will be run on the default interval of 60 seconds.
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.