hi there, folks:
I'd really like to release 0.7.0 but I would like it to be at least a
little bit tested before I do so. Could those of you with CVS trees check
everything out and see if it performs as advertised? Deeper bugs than
that will have to wait for the next release, but I'd at least like to know
if it works for someone other than me.
______ __ __ _____ _ _
| ____ | \_/ |_____] |_____|
|_____| |_____ | | | |
@ t w i s t e d m a t r i x . c o m
I have a twisted TCP server to listens to client, processes requests, do
mysql database operations if needed (using adbapi Connection pool) and
return the result. Before deploying this in production, I want to know
right way to configure the server.
Since twisted is single threaded, how can I leverage multiple cores of my
production machine (which has 6 cores and 16 GB RAM) ?
One approach that I thought of was to start multiple instances of twisted
server on different ports. This would help in using the other cores as
well. What do you guys suggest ?
Some of you may have heard rumors of some work in progress on a
replacement for Twisted's IConsumer/IProducer interfaces.
Tubes have been largely Glyph's effort (though a lot of people have
contributed in one way or another). And a large effort it's been.
Development is proceeding in a Twisted branch and comes to over three
thousand lines of additions so far.
Given the large size of the implementation and the long time that this
effort has been underway (I remember the Twisted meetup at the Rackspace
offices that *I* attended when I was visiting SF... a year and a half
ago... at which point tubes wasn't exactly a brand new project) I'd like
to re-raise the idea that the best next step for the project is to see
some distribution in its *current* state.
Specifically, I think it would be beneficial to set up a tubes project
on Github under the Twisted organization and try for a release in the
very near future.
I think this has several advantages over the status quo:
1) As an independent project, tubes will attract more attention than it
presently gets as a relatively unknown ticket & branch of Twisted.
2) As a separate Python package, the logistics of actually using tubes
are simpler (just consider how you might declare a dependency on a
branch of Twisted - keeping in mind you may want to use tubes in a
project that already depends on some version of Twisted). It may not
make sense to say that it is the same quality as Twisted proper right
off the bat (on the other hand, it may well - I suspect tubes in its
current form actually is a lot higher quality than large sections of
Twisted) but that doesn't mean people (not to mention the tubes project)
can't benefit from being able to experiment with it.
3) Decoupling tubes from Twisted frees tubes from certain of Twisted's
policies which are more challenging to follow for the kind of non-
trivial, brand new code base that tubes is. Technically we could just
say that these policies don't apply to a tubes package *in* Twisted but
this kind of subtle distinction is often lost on users (ie application
a) Twisted's compatibility policy need not apply. It could either be
sped up or abandoned more thoroughly. I'm generally a fan of being
backwards compatible even when you have few users because it actually
makes development easier, but loosening the policy to say things might
break if it's just really inconvenient to keep them working (whereas
Twisted goes to the inconvenience to keep them working) seems
b) tubes can undergo a faster release cycle to benefit more from user
4) At this point, a normal review of the tubes branch is going to be a
problem. We do not have good tools or mechanisms for dealing with
branches this large. The code in the current tubes branch can just
become master of a new project. Development going forward from this
point should continue to follow the feature-branch, small-changes, pre-
commit-peer-review process. But those 3k lines are written already.
Short of an extremely expensive effort to break the work up into
smaller, self-contained pieces there's simply never going to be a *good*
review in the typical style.
Additionally, it may turn out that tubes can remain independent
indefinitely. Someday perhaps Twisted would come to depend on it to
allow the various protocols and applications implemented in Twisted to
benefit from the superior abstractions it provides. Or maybe once it
has undergone a few iterations it will make sense to bring it back to
Twisted. I don't think this needs to be decided now.
There are downsides, of course. All of the boring maintenance involved
with having a separate project - setting up CI, actually doing the
releases, etc. Perhaps we could find some volunteers to help out with
these tasks, though, in exchange for getting some great code out there?
I'm curious what the folks out there who develop applications using
Twisted would find to be the easiest path forward. I'm also curious to
hear what Glyph thinks about all this. ;)
I found some time for adding a stub of SyslogObserver to the new t.p.logger.
Babel - a business unit of Par-Tec S.p.A. - http://www.babel.it
T: +39.06.9826.9651 M: +39.340.652.2736 F: +39.06.9826.9680
P.zza S.Benedetto da Norcia, 33 - 00040 Pomezia (Roma)
CONFIDENZIALE: Questo messaggio ed i suoi allegati sono di carattere
confidenziale per i destinatari in indirizzo.
E' vietato l'inoltro non autorizzato a destinatari diversi da quelli indicati
nel messaggio originale.
Se ricevuto per errore, l'uso del contenuto e' proibito; si prega di
comunicarlo al mittente e cancellarlo immediatamente.
While working on the package I just brought up in another thread, I realize we have another big new package coming in 14.1, "twisted.python.logger", and I'm wondering what the ".python" part of that package name is doing in there, and what value it adds. It's where "twisted.python.log" used to be, of course, but now I'm just wondering if we're just making the same mistake twice.
Does anyone have an opinion on renaming it to "twisted.logger"? Or have a better suggestion?
(For those of you wondering about the subject, note that this message is sent in compliance with This email sent in compliance with <https://twistedmatrix.com/trac/wiki/CompatibilityPolicy#ProcedureforExcepti…>.)
I've been trying to improve the reliability of the buildbots. (On that note, by the way, several builders are failing and more will be soon as security updates roll out, it would be great if someone could review <https://twistedmatrix.com/trac/ticket/7651> before the whole fleet turns red.)
In so doing I (re-)discovered this bug: <https://twistedmatrix.com/trac/ticket/2673>. At first I just wanted to delete an intermittently failing test which appears to be nonsense. However, after some prodding from exarkun, I investigated and discovered that this very poorly-written test case does in fact illustrate a real problem with our current threadpool implementation which can result in deadlocks, hangs on exit, and other unpleasantness. In my use of Twisted I have encountered several "huh, this can't happen, maybe cosmic rays or something" bugs which might have been caused by this, so I would very much like to fix it.
One reason that our threadpool implementation is problematic is that it has a somewhat complex internal design, lots of weird little features (context preservation, completion callbacks, workload estimation) all built at the same layer with no composition. I tried to figure out a way to salvage its current architecture and I could not reasonably do so.
I have prototyped a completely new threadpool implementation ("twisted.threads") in a spike. It is definitely not ready for review, but I would definitely appreciate design-level feedback on the code right now. You can see the implementation here: <https://twistedmatrix.com/trac/browser/branches/desynchronize-2673/twisted/…> (or here: <https://github.com/twisted/twisted/tree/desynchronize-2673/twisted/threads> if that's more your speed) It's less code than the existing implementation and provides more useful features at the same time. It might, in fact, provide some of the threading primitives that we would need for a reactor-per-thread implementation.
However, there is a very ugly implementation detail that prevents us from marching onwards to a glorious multithreading future: twisted.internet.interfaces.IReactorThreads.getThreadPool. The nominally "public" interface provided by its documented return type, the concrete (old-style!) class twisted.python.threadpool.ThreadPool, is ridiculously over-broad. Here are the features (attributes and methods) in its "public" interface:
Here's what I would like its public interface to be, more or less what it's intended to be, based on the ways it's documented and used in Twisted and in the various projects I can see using it:
It would not be too much effort to also preserve, for legacy purposes:
However, I would REALLY like to delete these implementation details:
Deleting these implementation details straight up would also make it such that anyone who inherited from the public class ThreadPool would not be able to override any of these things (oh my goodness, why would you do that, I really hope nobody has done that).
The three ways I could proceed, in order of my own preference, are:
Put the new implementation with entirely new interfaces into twisted.threads, put a compatibility shim into twisted.python.threadpool.ThreadPool that wraps those objects, provides my more minimal interface proposed above, and deletes 90% of its tests. Change IReactorThreads.getThreadPool to return a documented interface considerably more restricted than
Compatibility implications: twisted.internet.interfaces.IReactorThreads's contract would be relaxed. Implementors of IReactorThreads would not see an impact unless they were talking to deleted parts of ThreadPool internally. ThreadPool's clients would have several methods removed, and subclassing would effectively not be possible any more (a bunch of overridable hooks would have been removed, and no replacements would be provided). However, I prefer this option because there are an extremely restrictive set of use-cases (basically: only logging, any behavioral changes would have been broken) where clients could have made legitimate use of these attributes or overriding any of these functions.
Delete all of twisted.python.threadpool's test coverage, deprecate the entire module, and delete it in the next release (14.1+1). This has the advantage of making the test suite reliable, and gets the benefits for any users of callInThread, but does not relay any of the benefits to users of ThreadPool. The only ones doing this directly in Twisted are deferToThreadPool (and by extension, deferToThread) and WSGIResource. I could update these in tandem, however; the code changes would be very small. I don't think it would be incompatible to make WSGIResource itself accept a different type of constructor argument (although if we don't, I wonder if subclassing anything with a constructor can be considered applicable to the compatibility policy in Twisted; hmm).
Actually go through the trouble of emulating all the attributes on ThreadPool and emulating them as best I can. Delete the direct tests for ThreadPool itself and write a private subclass that will be returned from getThreadPool that returns a compatibility shim which isinstance(ThreadPool) for compatibility and still has all the gross attributes. This change would be technically compatible, but would be a huge amount of additional work and I am doubtful that it would provide any value.
So, does anyone out there have any code which makes use of the aforementioned bad attributes of ThreadPool, whose applications would break if I removed them? If so, how can I make you feel as bad about yourselves for using it as I feel bad about myself for writing it? ;-)
I am getting this traceback on about every source file like:
i5:~/ssdsrc/alt/Twisted/twisted/test (pb3) twistedchecker reflect_helper_ZDE.py
************* Module reflect_helper_ZDE
W9001: 1,0: Missing copyright header
W9002: 1,0: Missing a reference to test module in header
C0103: 1,0: Invalid name "reflect_helper_ZDE" for type module (should match (([a-z_][a-z0-9_]*))$)
W9208: 1,0: Missing docstring
Traceback (most recent call last):
File "/usr/local/bin/twistedchecker", line 5, in <module>
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/lib/python2.7/dist-packages/TwistedChecker-0.2.0-py2.7.egg/EGG-INFO/scripts/twistedchecker", line 10, in <module>
File "/usr/lib/python2.7/dist-packages/TwistedChecker-0.2.0-py2.7.egg/twistedchecker/core/runner.py", line 325, in run
File "/usr/lib/python2.7/dist-packages/pylint-0.26.0-py2.7.egg/pylint/lint.py", line 542, in check
self.check_astng_module(astng, walker, rawcheckers)
File "/usr/lib/python2.7/dist-packages/pylint-0.26.0-py2.7.egg/pylint/lint.py", line 615, in check_astng_module
File "/usr/lib/python2.7/dist-packages/pylint-0.26.0-py2.7.egg/pylint/utils.py", line 553, in walk
File "/usr/lib/python2.7/dist-packages/TwistedChecker-0.2.0-py2.7.egg/twistedchecker/checkers/pep8format.py", line 179, in visit_module
File "/usr/lib/python2.7/dist-packages/TwistedChecker-0.2.0-py2.7.egg/twistedchecker/checkers/pep8format.py", line 188, in _runPEP8Checker
recorder = PEP8WarningRecorder(file)
File "/usr/lib/python2.7/dist-packages/TwistedChecker-0.2.0-py2.7.egg/twistedchecker/checkers/pep8format.py", line 49, in __init__
File "/usr/lib/python2.7/dist-packages/TwistedChecker-0.2.0-py2.7.egg/twistedchecker/checkers/pep8format.py", line 78, in run
File "/usr/lib/python2.7/dist-packages/pep8-1.5.7-py2.7.egg/pep8.py", line 1445, in check_all
File "/usr/lib/python2.7/dist-packages/pep8-1.5.7-py2.7.egg/pep8.py", line 1338, in check_logical
for offset, text in self.run_check(check, argument_names) or ():
File "/usr/lib/python2.7/dist-packages/pep8-1.5.7-py2.7.egg/pep8.py", line 1278, in run_check
TypeError: modifiedBlankLines() takes exactly 6 arguments (7 given)
I noticed that https://twistedmatrix.com/trac/ticket/7355 is a blocker
for the release of Twisted 14.1 and #7355 is blocked Python 3.3 buildbot
Who can look at why one of the Python 3.3 slaves is offline and why
the two slaves are configured differently?