[openstack-dev] How to run period tasks by OpenStack way?

ChangBo Guo glongwave at gmail.com
Mon Aug 14 10:47:54 UTC 2017


I think You are missing initialization for running period tasks. You need
prepare a daemon service with period tasks like nova-compute
There are some key points to enable period task:

1. add period tasks to thread group
  https://github.com/openstack/nova/blob/master/nova/service.py#L194

2. make manager class inherit from periodic_task.PeriodicTasks
  https://github.com/openstack/nova/blob/master/nova/manager.py#L91

3. run service as daemon
 https://github.com/openstack/nova/blob/master/nova/cmd/compute.py#L56



2017-08-14 17:50 GMT+08:00 zhi <changzhi1990 at gmail.com>:

> Hi, all.
>
>     There are two ways to run period tasks in OpenStack. One is using
> "FixedIntervalLoopingCall" and the other is using the decorator named
> "periodic_task.periodic_task". Both of them are defining in Oslo service
> module.
>
>     My question is, how to use them in non OpenStack environment? In other
> words, how to use them in our own private projects? I have some demo codes
> at [1] and [2]. But may be there is something wrong with them. They didn't
> run periodically.
>
>     Could someone give me some advice?
>
>
> Thanks.
> Zhi
>
>
> [1]: http://paste.openstack.org/show/618295/
> [2]: http://paste.openstack.org/show/618296/
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>


-- 
ChangBo Guo(gcb)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170814/466e8bc2/attachment.html>


More information about the OpenStack-dev mailing list