List Info

Thread: Running Scheduled functions in Cherrypy




Running Scheduled functions in Cherrypy
user name
2006-03-15 15:54:15
Hi all,

Is there some way of extending cherrypy to include that
ability to
schedule the execution of a given function say, every week?

I have a cherrypy app that provides access to a database
with all the
usual CRUD and search functionality one would expect. The
next thing I
would like to add is the ability to send weekly emails to a
predetermined address.

If anyone has any bright ideas about how best to acheive
this I'd love
to hear them.

Cheers,

Rob C


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Running Scheduled functions in Cherrypy
user name
2006-03-15 16:11:29
Rob Cowie wrote:
> Is there some way of extending cherrypy to include that
ability to
> schedule the execution of a given function say, every
week?
> 
> I have a cherrypy app that provides access to a
database with all the
> usual CRUD and search functionality one would expect.
The next thing I
> would like to add is the ability to send weekly emails
to a
> predetermined address.
> 
> If anyone has any bright ideas about how best to
acheive this I'd love
> to hear them.

Hi Rob,

CherryPy doesn't provide anything for that directly.  I
think the best 
way of doing this is with the recur.py module from the
Dejavu project.

http://projects.amor.org/dejavu/browser/trunk/recur.py

It completely rocks for scheduled and recurring tasks.  And
it is 
written by Robert Brewer, who is one of the main developers
for 
CherryPy.  So there is your CP connection 

Christian
http://www.dowski.com



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Running Scheduled functions in Cherrypy
user name
2006-03-15 16:22:25
I have done this with a "daemon" thread in the
following way:
import cherrypy
import thread
import time

def daemon():
   while 1:
       do_periodic_stuff()
       time.sleep(seconds)

cherrypy.root = my_cherrypy_root()
thread.start_new_thread(daemon)
cherrypy.server.start()

In my "do_periodic_stuff" I am reading some
updated information and
then inserting it into a database and updating a global data
structure.
The cherrypy exposed methods are displaying information from
the global
data structure. Depending on what you want to do you may
need to use
some locks as well. I got away with not using any locks by
taking
advantage of the GIL.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )