[Python-Dev] futures API

Brian Quinlan brian at sweetapp.com
Thu Dec 9 18:02:41 CET 2010


On Dec 9, 2010, at 4:26 AM, Thomas Nagy wrote:

> Hello,
>
> I am looking forward to replacing a piece of code (http://code.google.com/p/waf/source/browse/trunk/waflib/Runner.py#86 
> ) by the futures module which was announced in python 3.2 beta. I am  
> a bit stuck with it, so I have a few questions about the futures:
>
> 1. Is the futures API frozen?

Yes.

> 2. How hard would it be to return the tasks processed in an output  
> queue to process/consume the results while they are returned? The  
> code does not seem to be very open for monkey patching.

You can associate a callback with a submitted future. That callback  
could add the future to your queue.

> 3. How hard would it be to add new tasks dynamically (after a task  
> is executed) and have the futures object never complete?

I'm not sure that I understand your question. You can submit new work  
to an Executor at until time until it is shutdown and a work item can  
take as long to complete as you want. If you are contemplating tasks  
that don't complete then maybe you could be better just scheduling a  
thread.

> 4. Is there a performance evaluation of the futures code (execution  
> overhead) ?

No. Scott Dial did make some performance improvements so he might have  
a handle on its overhead.

Cheers,
Brian

> Thanks,
> Thomas
>
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/brian%40sweetapp.com



More information about the Python-Dev mailing list