[Cubicweb] Scheduled hooks

St├ęphane Bugat stephane.bugat at free.fr
Wed Oct 24 16:06:38 CEST 2012

> Hi St?phane,
> You could create a ``server_startup`` hook that would register a
> "looping task", that is a function that will be executed
> periodically.
> Code will look like :
> from cubicweb.server import hook
> class SomeStartupHook(hook.Hook):
>      __regid__ = 'my-hook'
>      events = ('server_startup',)
>      def __call__(self):
>          self.repo.looping_task(24*60*60, my_func, arg1, arg2)

Great, many thanks... Googling a bit with you example I've found a full instance of it in the sources of marmoute (https://bitbucket.org/marmoute/pyti-master/src/fa3280f4cfce/hooks.py). I guess the duration is defined in seconds ;-)

More information about the Cubicweb mailing list