[Twisted-Python] when will failure.Failure() be a problem?

2012-03-22 Thread gelin yan
Hi All As regards issues like #5567 & #4219, Failure object creation is not thread safe. I use deferToThread daily due to many blocking apis still have to be used in my system. I looked into the code and noticed there is a global count used in Failure.__init__. An increment will be made for every

Re: [Twisted-Python] [Twisted-commits] r33889 - Merge elementresource-5395: Add renderElement, for rendering Elements.

2012-03-22 Thread Glyph
On Mar 22, 2012, at 9:18 PM, exar...@twistedmatrix.com wrote: > On 19 Mar, 09:10 pm, gl...@twistedmatrix.com wrote: >> >> On Mar 18, 2012, at 9:44 AM, exar...@twistedmatrix.com wrote: >>> So essentially we do require this already, but reviewers seem to >>> largely >>> ignore it (so even if we d

Re: [Twisted-Python] [Twisted-commits] r33889 - Merge elementresource-5395: Add renderElement, for rendering Elements.

2012-03-22 Thread exarkun
On 19 Mar, 09:10 pm, gl...@twistedmatrix.com wrote: > >On Mar 18, 2012, at 9:44 AM, exar...@twistedmatrix.com wrote: >>So essentially we do require this already, but reviewers seem to >>largely >>ignore it (so even if we decide this should not be a requirement, >>reviewers are not doing their job

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Uri Okrent
On Thu, Mar 22, 2012 at 3:04 PM, Tim Allen wrote: > So the only possible results are 0 and 3, because the 'synchronisation > points' are at the edges of callbacks. Ok, awesome. That's the bit that I couldn't quite understand. Thanks! --   Uri Please consider the environment before printing th

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Tim Allen
On Thu, Mar 22, 2012 at 02:34:41PM +0200, Uri Okrent wrote: > Maybe I should clarify my question: > > thing = 0 > def a(): > thing += 1 > thing += 1 > thing += 1 > thing += 1 > thing += 1 > > def b(): > thing = 0 > > def show_thing(): > print thing > > a.addCallback(

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Orestis Markou
On 22 Μαρ 2012, at 12:34 μ.μ., Uri Okrent wrote: > On Thu, Mar 22, 2012 at 2:17 PM, Itamar Turner-Trauring > wrote: >> On 03/22/2012 08:05 AM, Uri Okrent wrote: >>> This implies that twisted can (and will) switch contexts from one >>> deferred to another even in the middle of execution of the fi

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Uri Okrent
On Thu, Mar 22, 2012 at 2:18 PM, Ilja Livenson wrote: > we have been stumbling on the same problems when using ZODB. The > current solution is to defer db operations to a threadpool. We also > have rdonly and rw transaction decorators, which can be used for > speeding up processing/custom logic. I

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Uri Okrent
On Thu, Mar 22, 2012 at 2:17 PM, Itamar Turner-Trauring wrote: > On 03/22/2012 08:05 AM, Uri Okrent wrote: >> This implies that twisted can (and will) switch contexts from one >> deferred to another even in the middle of execution of the first >> deferred, correct? > > No. Deferreds are just sligh

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Itamar Turner-Trauring
On 03/22/2012 08:05 AM, Uri Okrent wrote: > This implies that twisted can (and will) switch contexts from one > deferred to another even in the middle of execution of the first > deferred, correct? No. Deferreds are just slightly nicer callbacks. They have nothing to do with the event loop, or sc

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Ilja Livenson
Hi, Uri > So what I didn't mention earlier because I wanted to keep my questions > simple, is we're already using sqlalchemy and its ORM so I don't think > I can use adbapi.  The way things have been working (and it's not so > scalable) is every request that does any kind of modification grabs a >

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Uri Okrent
Thanks for the excellent responses guys. So a couple more things... On Thu, Mar 22, 2012 at 1:37 PM, Tim Allen wrote: > A Deferred can wait on the result of other Deferreds; while one Deferred > is waiting (say, waiting for a timer to go off, or waiting for network > activity), others may be run

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Tim Allen
On Thu, Mar 22, 2012 at 12:20:37PM +0200, Uri Okrent wrote: > 1. Is deferToThread running the function in a real python thread? > Should this be used (rather than a standard deferred) for any function > that might block? Yes, deferToThread() runs things in a real Python thread. If you have code th

[Twisted-Python] [ANN]: Autobahn WebSockets new release

2012-03-22 Thread Tobias Oberstein
New releases of AutobahnPython and AutobahnTestSuite completed: AutobahnPython == Release 0.5.0 of AutobahnPython is done, including a bunch of new features, improvements and some fixes: WebSocket: - DoS protection: WS opening handshake timeouts (configurable) - DoS p

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Tobias Oberstein
> For PostgreSQL, I would also have a look at > > https://github.com/oberstet/txpostgres sorry, wrong link .. use the original: https://github.com/wulczer/txpostgres not my forked stuff. ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.co

Re: [Twisted-Python] questions about twisted usage

2012-03-22 Thread Tobias Oberstein
> 5. Related to all of the above. What If I want to modify a database inside a > deferred? Is that incorrect usage? Specifically, if all my requests run as For database access, in general, you would follow http://twistedmatrix.com/documents/current/core/howto/rdbms.html This is a Twisted wrap

[Twisted-Python] questions about twisted usage

2012-03-22 Thread Uri Okrent
Hello all, I'm a twisted novice, but I was brought on to a project where twisted is pretty heavily in use. I'm running into all sorts of issues that make me wonder if we're using twisted properly or as it was intended. I have been through the documentation, but I think I need more in-depth answer