List Info

Thread: Running Scheduled functions in Cherrypy




Running Scheduled functions in Cherrypy
user name
2006-03-15 16:36:10
Christian Wyglendowski wrote:
> 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 

*blush* but yes, that is what I would have suggested, too. I
use it in
production. Have a look at the Worker class in that module.

Dejavu includes that module, but it's designed and
distributed as a
standalone. See http://proje
cts.amor.org/misc/wiki/Recur


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org

--~--~---------~--~----~------------~-------~--~----~
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 17:12:06
Thanks, I'll take a look at it.

I was beginning to go mad trying to get the sched module to
do what I
want. I've never used it before but it certainly seems to
be one of the
weakest members of the python standard library.

I'll let you know how I get on with recur. One thing that I
might need
some help with is where to incorporate it in my server.
Should it be in
its own thread? etc.

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-30 07:52:01

Robert Brewer wrote:

> Dejavu includes that module, but it's designed and
distributed as a
> standalone. See http://proje
cts.amor.org/misc/wiki/Recur

Off topic for Cherrypy, but related to the subject,

Is there a simple sample somewhere that shows a not so
confident Python
user, like me, how to use the recur module?

I'd like to use it to make time lapse movies. For example,
take an
image every 30 minutes between 7.00 and 17.00 on each
work-day and none
in the weekend.

Ingo


--~--~---------~--~----~------------~-------~--~----~
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-30 11:29:35
I too stored references to my worker objects and iterated
through them
calling .stop(). It didn't work.

I did verify that the stop() method was being called.

Since then - I have changed the way I instantiate the worker
objects. I
had used:
 
'cherrypy.server.start_with_callback(scheduler.create_weekl
y_email)'.

Now I just add 'scheduler.create_weekly_email' to the
'on_server_start_list' and all is well. I'm not sure why
that is the
case - possibly something to do with the callback being
executed in a
thread separate from the server.

Ingo: you are welcome to take a look at the code I use. It
is
relatively simple so might serve as a good example. If you
want me to
email it - let me know.

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-30 11:50:01

Rob Cowie wrote:

> Ingo: you are welcome to take a look at the code I use.
It is
> relatively simple so might serve as a good example. If
you want me to
> email it - let me know.
> 

Thanks Rob, that would be great,

Ingo


--~--~---------~--~----~------------~-------~--~----~
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-5]

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