> It's still not clear to me specifically what you're trying to do. It
> would really help if you would describe the problem in more detail.
> Here's what I think you're trying to do:
> 
> 1) Submit a task to a ThreadPoolExecutor and get back a future.
> 
> 2) When the task is complete, submit another task that needs the
> result of the first task to do its work.
> 
> 3) When the chained task is complete, return the final result of the
> chained task back to whoever submitted the original task via the
> original task's future.
> 
> The problem arises in that the original task's future already
> completed when the original task did. The chained task sets its result
> in a different future that the submitter didn't know about.

Yes, I may have 2 or more tasks that depend on the previous.
They are each distinct tasks, or continuations, so they each want the result
of the previous task however each one can cancel the set.

The callback model doesn't apply, its based on the result of _one_ task.

What I need I are continuations, much like the .NET TPL.

def task_a():
    return "a"

def task_b():
    return "b"

def task_c():
    return "c"

So I submit task_a, if it completes successfully, task_b runs on its result.
If task_b completes successfully, task_c runs on its result. They "look"
like callbacks, but they are continuations.

Task_b must be able to cancel the continuation of task_c  if it see's task_a
has failed.

Thanks for the continued help!
jlc
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to