Stopping threads from the outside

holger at trillke.net holger at trillke.net
Sun Mar 24 18:29:36 EST 2002


> > > "The network"?  Which one?  The Internet, or an internal
> > > network over which you have full control?  Who controls
> > > the servers on which these agents will be running?
> > 
> > well. at the moment the servers are under my control.
> > but this is hopefully going to change.
> 
> So is your purpose in shutting down threads that you want
> to prevent agents written by others from running forever?
> Or can you count on the good behaviour of those writing 
> agents to run on these servers?

Mainly i want to be able to replace running agents
(for the develop/deploy/test-cycle).

> > In fact it is quite hard to group the agent-threads because they are very
> > autonomous (and btw quite cooperative with other agents).
> 
> "Cooperative"?  As in, working together on problems?  Or
> working on their own individual problems without any 
> interference or perhaps interaction?

ok. speaking plaintext: 

one agent is constructing (updating) and providing 
navigationable Music-Objects (like Song, Group, CD).
another is analyzing samba- and other logfiles 
to see which song was played when/how often/...
the third provides methods for a "virtual
hitparade" like "top ten" and stuff. this one
works on the other agents. actually a fourth
one is also installed (a "quixote"-agent) which provides
a web interface (using the third "scoring" agent).

So basically one Agent-Thread may call into methods of another
agent (not message-oriented, calls into the other modules
in the same thread).

But i want to be able to "correct" the code of e.g. the Music-Objects Agent:
i have to first stop/kill the thread which might be in the process of 
updating stuff. then bring in new code and deploy it. the last
part actually works. killing the agent is the issue which i originally 
wanted to "solve" generically.

The prescribed "ThreadInterruptException" could be generated by the 
python-interpreter working on this thread. Something like 
threading.interrupt(threading.Thread-instance) would signal the 
interpreter to generate an exception on the next possible occasion. Is 
this nonsense or a sensitive approach?

thanks,

	holger




More information about the Python-list mailing list