kill a python script spawned from java/Jython

The Dude me at me.com
Fri Jul 30 13:00:36 EDT 2004


ok, pretty new to python. in new job, took over some code, basically, it
spawns a LOT of little python scripts. parent java program is
multi-threaded.

Current code wraps pythonInterpreter into class which synchronizes exec()
method. Comments says he did this because was concerned about threading.

first, is this a good idea? comments?

Anway, we occassionaly seem to be having a "dead thread" and I wondered if
one of these python scripts is getting into an infinite loop or something
(before you say "go look at them" there are hundreds and hundreds executing
over and over. it's not even really an option to log each entry/exit. The
logs are just too huge. It would kill performance, which is already a
problem in production and it only occurrs in production.. So my thought was
to put a timer (maybe launch a class which sleeps and then kills the thread
once the scripts executes) and then kill the nonresponding python script.

So how do I do this. I see a PySystemState.exit() but this is a STATIC
method. So wouldn't it kill ALL executing scripts (remember, even though
this method is synchronized, there are other java threads, so wouldn't there
be others executing?).

Any thoughts would be appreciated. Just respond to group, as I wasn't able
to find much through googling on this topic, so let's fix that :)





More information about the Python-list mailing list