client-server parallellised number crunching

Hans Georg Schaathun hg at
Wed Apr 27 14:21:53 CEST 2011

On Wed, 27 Apr 2011 11:35:16 +0200, Thomas Rachel
  <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at> wrote:
:  As far as I understand, you acquire a job, send it to a remote host via 
:  a socket and then wait for the answer. Is that correct?

That's correct.  And the client initiates the connection.  At the
moment, I use one thread per connection, and don't really want to
spend the time to figure out how to do it singlethreadedly.

:  In this case, I would put running jobs together with the respective 
:  socket in a "running queue". If you detect a broken connection, put that 
:  job into the "todo" queue again.

Probably not a queue.  Maybe a dictionary.  After all I need to look up
the job later.

:  Of course, why not? It might depend on some settings you set (keepalive 
:  etc.); but generally you should get an exception when trying a 
:  communication over a disconnected connection (over a disconnection? ;-))

There are several challenges there and more than one solution.
One concern of mine, which is not necessarily justified, is that I
do not quite know if I know of all the possible error cases.  

I suppose your solution works if I run a relatively short timeout 
on the server and send regular ping messages from the client.

:-- Hans Georg

More information about the Python-list mailing list