Reloading code without shutting down the app

Max Ischenko max at malva.com.uaREMOVE.IT
Tue Sep 24 07:36:03 EDT 2002


Hello.

I have an application which processes some incoming data (recv. as UDP
packets). Currently it is implemented as two threads: first is recieving
data and "put" it into Queue.Queue while second thread "get" data from the
queue and process it.

The problem is when I restart my application to load new
changes some packets could be lost due to unreliable nature of the UDP
protocol.

The solution could be to use TCP-link instead of Queue to bind the
producer and the consumer programs. Then, if the consumer is down the
producer would accumulate data and send it when the link would be
restored.

While workable, this solution seems too complex to me.
Changing UDP transport to TCP is outside of my scope either.

Does python have some ways to reload source code of already running
modules? For example, when consumer recv. a SIGHUP it would delete
currently used objects/classes/modules, import all again, creates objects
and continues to process the data from the Queue.

Is it possible? And how?


-- 
Real Programmers Don't Use Pascal!



More information about the Python-list mailing list