Fredrik Sandin
fredrik.sandin at ltu.se
Fri Aug 25 09:16:28 EDT 2006
Hello! I am new to mod_python and could need some advice. I want to create an online GUI with mod_python for an existing application written in Python. The Python application organizes distributed computations and therefore maintains network connections to a number of computers. Users post jobs, which are sent somewhere for execution and then the result is sent back by a callback function. Illustration of principle: class MyComputerCluster: def __init__(self, callback): self.callback = callback ... def post_job(self, description): ... def mycallback(userid, result): print 'User %d requested: %s' % (userid, result) mycluster = MyComputerCluster(mycallback) mycluster.post_job('compute the meaning of 42') ... Now, there is one major issue - Is it possible to create an object of type MyComputerCluster for each user of the online GUI and keep it in memory between calls, without spoiling the network connections maintained by the object? Session variables can be used as reference for a persistent object, but how to create it? A solution would be to write an independent service that creates the objects and listens for requests (post_job, get_result), but that takes time... Cheers, Fredrik
|