[Twisted-Python] Scheduling tasks in twisted

Stéphane Brault stephane_brault at yahoo.fr
Tue Jun 27 13:28:02 EDT 2006


Thanks Moof,
  in fact i need to call different functions. I didn't know about the timerservice. For the cron-style scheduler
  you could try googling 'zope twisted integration', there is a link to Stephen Richter's integration with 
  a cron task. My concern was how, inside an application to launch tasks (or a looping call) at the initialization.
  I tried an example but it didn't seem to work.
  
  Thanks again,
  
  Stéphane

----- Message d'origine ----
De : Moof <moof at metamoof.net>
À : Stéphane Brault <stephane_brault at yahoo.fr>; Twisted general discussion <twisted-python at twistedmatrix.com>
Envoyé le : Mardi, 27 Juin 2006, 7h13mn 23s
Objet : Re: [Twisted-Python] Scheduling tasks in twisted

On 6/27/06, Stéphane Brault <stephane_brault at yahoo.fr> wrote:
> Hi,
>  I'm developping servers which communicate with webservices. I need to have
>  looping tasks making calls every x (x depends on the task). My communication
>  code works well but I'm not sure how to add scheduled tasks. Do I have to add
>  a scheduler service, if so how should i go ? Or is there another way ?

If you just need a function called every x seconds, then you can use a
twisted.internet.service.TimerService attached to your application in
the .tac file.

If you want to do it outside the service architecture, then
twisted.internet.task.LoopingCall is more your sort of thing.

To my knowledge, there is no cron-style scheduler in twisted, which
would allow you to run  at 9:00am every day or second tuesday or
schedules to that effect. You may wish to use cron to do that, running
applications that connect to your daemon using pb or some other
similar mechanism and trigger the action.

That being said, I'm currenly considering writing such a service for
twisted itself, too.

Moof







More information about the Twisted-Python mailing list