Le 29/06/2011 23:30, Mike Orr a écrit :
On Wed, Jun 29, 2011 at 10:40 AM, hisan<[email protected]> wrote:
how to call a function for evry 10 secs in python
I assume this is a Pylons or Pyramid application since this is
pylons-discuss. The easiest way would probably be to start a thread in
the initialization code (environment.py for Pylons, main() for
Pyramid). The thread would run a long-running function with a loop
that that records its start time, does its thing, sleeps for ``(10
seconds - (now - start_time))``, and repeats.
Another way to do repeated events is with cron, possibly using "paster
request". But that won't work in this case because cron can't handle
intervals of less than a minute.
Celery library can't help to do this task ?
http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html
Regards,
Stephane
--
Stéphane Klein <[email protected]>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.