[IPython-dev] taskclient clear and hierarchical parallel processing
MinRK
benjaminrk at gmail.com
Thu May 13 19:09:32 EDT 2010
Issue 2:
You can possibly avoid deadlocks by allowing the parent task to throw
a dependency unmet error, so that it gets resubmitted and waits for
the child.
Since we are allowing tasks to submit tasks, let's assume that every
engine has a MultiEngineClient (mec) and TaskClient (tc) connected to
the controller.
The current (in-progress) dependency implementation is to raise
IPython.kernel.error.TaskRejectError if a dependency is not met. You
can use this
# init, run on all engines:
from IPython.kernel.error import TaskRejectError
taskIDs = {} # a dict to live on all engines
ParentTask:
if not taskIDs.has_key(child_signature): # child hadn't been submitted
tid = tc.run(child_task)
mec.execute("taskIDs['%s'] = tid"%(child_signature, tid)
raise TaskRejectError # tell controller dependency is unmet
child_result = tc.get_result(taskIDs[child_signature],block=False)
if child_result is None: # child isn't done
raise TaskRejectError
# only get here if child is done
do_work(child_result)
...
Adding the mec.execute call is not the greatest solution, but it does
ensure that all engines have the same value of taskIDs[sig] for all
tasks submitted to workers after this call.
I haven't actually run this, but something along this model should
work. The dependency implementation is a work in progress.
-MinRK
On Thu, May 13, 2010 at 04:46, Satrajit Ghosh <satra at mit.edu> wrote:
> hi fernando,
>
>> >
>> > We don't have a way of doing this currently. Basically, you should
>> > call clear() when you know all clients are done with a set of tasks
>> > and you want to free up that memory.
>>
>> Mmmh, I now realize that I think I misunderstood Satra earlier today.
>> Satra, clear() only flushes *already completed* tasks. Do you want to
>> cancel tasks, or clear completed ones but by id?
>
> clear completed ones but by id. the reason i can't call clear is that i used
> the id to get the result. so i would need to know that all clients don't
> have any pending results *and* while i'm doing the clearing no pending task
> has completed. this seems like a philosopher's chopstick nightmare if not
> handled properly through parallel semantics.
>
> cheers,
>
> satra
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
More information about the IPython-dev
mailing list