Re: [Twisted-Python] Want something fixed?

2011-01-10 Thread Jonathan Lange
On Tue, Jan 4, 2011 at 9:15 PM,  exar...@twistedmatrix.com wrote:
 Hi all,

 I'd like someone to do a review on #4395 - a ticket about some conch key
 exchange bugs.  The branch isn't very large, a little under 500 lines of
 diff (with nearly a hundred of those deletions).

 In exchange for a thorough review (and perhaps a re-review if issues are
 found which need to be fixed), I'd be happy to spend as much as a full
 day working on some other issue of the reviewer's choice.


Have you found a volunteer yet?

If not, I can do a thorough review this weekend. In exchange, I'd very
much like my pyflakes branch to be reviewed and landed. (Although
perhaps I should ask for moving pyflakes to Launchpad?)

jml

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Want something fixed?

2011-01-10 Thread exarkun

On 05:11 pm, j...@mumak.net wrote:

On Tue, Jan 4, 2011 at 9:15 PM,  exar...@twistedmatrix.com wrote:

Hi all,

I'd like someone to do a review on #4395 - a ticket about some conch 
key
exchange bugs.  The branch isn't very large, a little under 500 lines 
of

diff (with nearly a hundred of those deletions).

In exchange for a thorough review (and perhaps a re-review if issues 
are

found which need to be fixed), I'd be happy to spend as much as a full
day working on some other issue of the reviewer's choice.


Have you found a volunteer yet?

If not, I can do a thorough review this weekend. In exchange, I'd very
much like my pyflakes branch to be reviewed and landed. (Although
perhaps I should ask for moving pyflakes to Launchpad?)


Woops, yes, I should have followed up on Friday.  Michael Hudson did the 
review, and this ticket is now resolved.


As far as moving pyflakes to Launchpad goes, talk to me on IRC.  We are 
trying to do that but might need some help. :)


Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted and ICP protocol

2011-01-10 Thread Roberto Franchesco
Hello All,

I have been trying to get a squid proxy to talk to a twisted proxy
and I came across an old email from this list where someone mentioned
that they had implemented a basic ICP protocol in twisted.

Does anyone still have that implementation?  Or any good pointers on
setting me off in the right direction as to how to do this?

-Rob

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread Alex Grönholm
There has been some discussion over email between myself and several 
Twisted developers regarding the possibility of adding support for PEP 
3148 futures and executors to Twisted. I'm starting this thread to move 
the conversation to this mailing list to gain a broader audience.

For those who do not know what PEP 3148 is about, suffice to say that 
it's an API for deferred execution of code. The reference implementation 
can be found in the Python 3.2 standard library under the package name 
concurrent.futures. A backport that works on Python 2.5, 2.6, 2.7 and 
3.1 has been made available by Brian Quinlan and myself and is available 
for download at the Python Package Index.

A brief summary of the email conversations:

* The purpose of integrating PEP 3148 support is the intended shift 
towards a common API for creating asynchronous applications
* Deferreds and Futures are alike in purpose but very different under 
the hood
* Support for the Futures API cannot be integrated directly to Deferreds 
because of the result attribute which is a method in Future but a 
value in Deferred
* Some people suggested wrapping Futures in Deferreds, though I have yet 
to hear a rationale for this
* PEP 3148 executor support could be directly integrated to Twisted's 
thread pools (and by extension, reactors) as there are no naming 
conflicts that I'm aware of

The main focus of the discussion is to figure out how to best integrate 
support for this new API to Twisted. If possible, existing protocols 
should remain compatible through the use of adapters or some other 
mechanism. If not, a way to port them over with a minimal amount of work 
would be the next target.

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread Jason J. W. Williams
Do futures support chaining? From a cursory read of PEP 3148 it
doesn't look like they do.

-J

2011/1/10 Alex Grönholm alex.gronh...@nextday.fi:
 There has been some discussion over email between myself and several
 Twisted developers regarding the possibility of adding support for PEP
 3148 futures and executors to Twisted. I'm starting this thread to move
 the conversation to this mailing list to gain a broader audience.

 For those who do not know what PEP 3148 is about, suffice to say that
 it's an API for deferred execution of code. The reference implementation
 can be found in the Python 3.2 standard library under the package name
 concurrent.futures. A backport that works on Python 2.5, 2.6, 2.7 and
 3.1 has been made available by Brian Quinlan and myself and is available
 for download at the Python Package Index.

 A brief summary of the email conversations:

 * The purpose of integrating PEP 3148 support is the intended shift
 towards a common API for creating asynchronous applications
 * Deferreds and Futures are alike in purpose but very different under
 the hood
 * Support for the Futures API cannot be integrated directly to Deferreds
 because of the result attribute which is a method in Future but a
 value in Deferred
 * Some people suggested wrapping Futures in Deferreds, though I have yet
 to hear a rationale for this
 * PEP 3148 executor support could be directly integrated to Twisted's
 thread pools (and by extension, reactors) as there are no naming
 conflicts that I'm aware of

 The main focus of the discussion is to figure out how to best integrate
 support for this new API to Twisted. If possible, existing protocols
 should remain compatible through the use of adapters or some other
 mechanism. If not, a way to port them over with a minimal amount of work
 would be the next target.

 ___
 Twisted-Python mailing list
 Twisted-Python@twistedmatrix.com
 http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread Alex Grönholm
11.01.2011 00:01, Jason J. W. Williams kirjoitti:
 Do futures support chaining? From a cursory read of PEP 3148 it
 doesn't look like they do.
They don't support chaining. Like I said, the underlying mechanics are 
quite a bit different from Deferreds. I don't really see that as a 
problem. Feel free to argue against this.
 -J

 2011/1/10 Alex Grönholmalex.gronh...@nextday.fi:
 There has been some discussion over email between myself and several
 Twisted developers regarding the possibility of adding support for PEP
 3148 futures and executors to Twisted. I'm starting this thread to move
 the conversation to this mailing list to gain a broader audience.

 For those who do not know what PEP 3148 is about, suffice to say that
 it's an API for deferred execution of code. The reference implementation
 can be found in the Python 3.2 standard library under the package name
 concurrent.futures. A backport that works on Python 2.5, 2.6, 2.7 and
 3.1 has been made available by Brian Quinlan and myself and is available
 for download at the Python Package Index.

 A brief summary of the email conversations:

 * The purpose of integrating PEP 3148 support is the intended shift
 towards a common API for creating asynchronous applications
 * Deferreds and Futures are alike in purpose but very different under
 the hood
 * Support for the Futures API cannot be integrated directly to Deferreds
 because of the result attribute which is a method in Future but a
 value in Deferred
 * Some people suggested wrapping Futures in Deferreds, though I have yet
 to hear a rationale for this
 * PEP 3148 executor support could be directly integrated to Twisted's
 thread pools (and by extension, reactors) as there are no naming
 conflicts that I'm aware of

 The main focus of the discussion is to figure out how to best integrate
 support for this new API to Twisted. If possible, existing protocols
 should remain compatible through the use of adapters or some other
 mechanism. If not, a way to port them over with a minimal amount of work
 would be the next target.

 ___
 Twisted-Python mailing list
 Twisted-Python@twistedmatrix.com
 http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

 ___
 Twisted-Python mailing list
 Twisted-Python@twistedmatrix.com
 http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread Christopher Armstrong
2011/1/10 Alex Grönholm alex.gronh...@nextday.fi

 There has been some discussion over email between myself and several
 Twisted developers regarding the possibility of adding support for PEP
 3148 futures and executors to Twisted. I'm starting this thread to move
 the conversation to this mailing list to gain a broader audience.

 For those who do not know what PEP 3148 is about, suffice to say that
 it's an API for deferred execution of code.



I just want to make clear up-front the subtle point that Twisted's Deferreds
are not tools for deferred execution of code, but rather for deferred
receipt of results. It's easy to forget this and believe that the similar
jargon implies similarity in purpose.


-- 
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread Alex Grönholm

11.01.2011 01:26, Christopher Armstrong kirjoitti:
2011/1/10 Alex Grönholm alex.gronh...@nextday.fi 
mailto:alex.gronh...@nextday.fi


There has been some discussion over email between myself and several
Twisted developers regarding the possibility of adding support for PEP
3148 futures and executors to Twisted. I'm starting this thread to
move
the conversation to this mailing list to gain a broader audience.

For those who do not know what PEP 3148 is about, suffice to say that
it's an API for deferred execution of code.



I just want to make clear up-front the subtle point that Twisted's 
Deferreds are not tools for deferred execution of code, but rather 
for deferred receipt of results. It's easy to forget this and 
believe that the similar jargon implies similarity in purpose.
I never wanted to imply that -- I apologize if I left the wrong 
impression. PEP 3148 Futures have the exact same high level purpose as 
Deferreds in that they are essentially receipts for results. Like 
Deferreds, they are not tied to any particular executor.



--
Christopher Armstrong
http://radix.twistedmatrix.com/
http://planet-if.com/



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread exarkun
On 01:54 am, screwt...@froup.com wrote:

Just a couple quick (minor) factual corrections.  I'll snip everything 
that does not appear to need correction (of which there was a lot) to 
make it easier to read.
- Futures support cancellation; Twisted finally managed to get rid
  of cancellation support in Deferreds.

We only got rid of Deferred.setTimeout.  In exchange, we added 
generalized cancellation support.
It should be pretty simple to create a Deferred that wraps a Future:

from twisted.internet import defer

def deferredFromFuture(future):
 d = defer.Deferred()
 def callback(future):
 e = future.exception()
 if e:

Futures may call their callbacks in any thread.  So the line:
 d.fail(e)

must instead be something like:

reactor.callFromThread(d.errback, e)


(notice also `d.callback`, not `d.fail`).  A similar change is necessary 
for the success case below.
 return

 d.succeed(future.result())

 future.add_done_callback(callback)
 return d

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and PEP 3148 support

2011-01-10 Thread Tim Allen
On Tue, Jan 11, 2011 at 02:15:59AM -, exar...@twistedmatrix.com wrote:
 On 01:54 am, screwt...@froup.com wrote:
 - Futures support cancellation; Twisted finally managed to get rid
   of cancellation support in Deferreds.
 
 We only got rid of Deferred.setTimeout.  In exchange, we added 
 generalized cancellation support.

Ah, yes, I misremembered. Thank you for the correction.

I haven't used Deferred's cancellation support; I don't know how
compatible it is with Future's cancellation support.

 Futures may call their callbacks in any thread.  So the line:
  d.fail(e)
 
 must instead be something like:
 
 reactor.callFromThread(d.errback, e)

PEP 3148 says:
# Added callables are called in the order that they were added and are
# always called in a thread belonging to the process that added them.

I assumed that implied some kind of internal .callFromThread() magic;
I could be wrong.

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python