List Info

Thread: Running Scheduled functions in Cherrypy




Running Scheduled functions in Cherrypy
user name
2006-03-29 17:57:24
Rob Cowie wrote:
> Well recur works a treat!
> 
> However.... I have one remaining problem.
> 
> On cherrypy server startup, I call a function that
creates a custom
> recur.Worker object and calls its .motivate() method. A
new thread is
> spawned and the worker does its thing when required.
> 
> I had assumed that when I kill the cherrypy server, all

> threads spawned
> by it would be killed as well. This is not the case.
So, I added a
> function that should call the .stop() function of my
worker object.
> 
> Is this enough to kill the thread? Currently, when I
kill cherrypy at
> the command line with cmd-C, I am not returned to a
shell prompt as a
> thread is still running.

It should be enough. Here's what I do (with a
"workers" dict) that works
fine:

def unload_workers():
    while workers:
        name, worker = workers.popitem()
        worker.stop()

Tracking down which thread is hanging can be an involved
process. Have
you verified that your stop() call is actually being
executed? (through
liberal use of log() statements or your favorite debugging
tool ;)


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

[1]

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