Author gdb
Recipients asksol, gdb, jnoller
Date 2010-08-13.20:53:00
SpamBayes Score 8.57359e-12
Marked as misclassified No
Message-id <1281732795.5.0.631587079383.issue9205@psf.upfronthosting.co.za>
In-reply-to
Content
I'll take another stab at this.  In the attachment (assign-tasks.patch), I've combined a lot of the ideas presented on this issue, so thank you both for your input.  Anyway:

- The basic idea of the patch is to record the mapping of tasks to workers.  I've added a protocol between the parent process and the workers that allows this to happen without adding a race condition between recording the task and the child dying.
- If a child unexpectedly dies, the worker_handler pretends that all of the jobs currently assigned to it raised a RuntimeError.  (Multiple jobs can be assigned to a single worker if the result handler is being slow.)
- The guarantee I try to provide is that each job will be started at most once.  There is enough information to instead ensure that each job is run exactly once, but in general whether that's acceptable or useful is really only known at the application level.

Some notes:
- I haven't implemented this for approach for the ThreadPool yet.
- The test suite runs but occasionally hangs on shutting down the pool in Ask's tests in multiprocessing-trunk@82502-termination-trackjobs.patch.  My experiments seem to indicate this is due to a worker dying while holding a queue lock.  So I think a next step is to deal with workers dying while holding a queue lock, although this seems unlikely in practice.  I have some ideas as to how you could fix this, if we decide it's worth trying.

Anyway, please let me know what you think of this approach/sample implementation.  If we decide that this seems promising, I'd be happy to built it out further.
History
Date User Action Args
2010-08-13 20:53:15gdbsetrecipients: + gdb, jnoller, asksol
2010-08-13 20:53:15gdbsetmessageid: <1281732795.5.0.631587079383.issue9205@psf.upfronthosting.co.za>
2010-08-13 20:53:09gdblinkissue9205 messages
2010-08-13 20:53:08gdbcreate