Re: [Twisted-Python] (Mis)indented Posts

2009-07-06 Thread Gerrat Rickert
>-Original Message-
>From: twisted-python-boun...@twistedmatrix.com [mailto:twisted-python-
>boun...@twistedmatrix.com] On Behalf Of James Y Knight
>Sent: Sunday, July 05, 2009 4:51 PM
>To: Twisted general discussion
>Subject: Re: [Twisted-Python] (Mis)indented Posts
>
>
>On Jul 3, 2009, at 10:32 AM, Gerrat Rickert wrote:
>
>> ...ok, I've created a new post twice on this list twice, and both
>> times
>> my post has been indented and placed under a completely
>> different/irrelevant post
>>
>> Here:
>> http://twistedmatrix.com/pipermail/twisted-python/2009-June/
>> 019859.html
>> And Here:
>> http://twistedmatrix.com/pipermail/twisted-python/2009-July/
>> 019902.html
>>
>> ...if this post hijacks a thread as well, then it will be 3 times.
>>
>> ...this seems to be something specific to the twisted python mailing
>> list:
>> http://www.mail-archive.com/mailman-users%40python.org/msg53996.html
>
>I really don't know how that could be specific to the twisted python
>list. I notice in the referenced message, Mark Sapiro says that
>rebuilding the archives from the mbox file generated correct threading
>for him. Well, I just did that, ("mmarch --wipe twisted-python") and
>it generated the same incorrect bad threading.
>
>Perhaps it's a bug in mailman 2.1.9-9ubuntu1 which has been fixed
>already upstream?
>
>James

Thanks for testing this James.  Before I send this back to the mailman
list, could you tell me, would that be a "stock" 2.1.9-9ubuntu1 mailman
installation you rebuilt on?  ie. is there any custom configuration
specific to this list that could be causing this odd behaviour (instead
of a bug with the ubuntu version)?  [please excuse my ignorance if this
question doesn't make sense - I know nothing about mailman...I just want
to stop hijacking threads when I post here]

Thanks, Gerrat

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


Re: [Twisted-Python] untwisting twistd

2009-07-06 Thread Jared Gisin
Mikhail is correct in what needs to be done here. Twistd should provide
helpers to writing an application without being the application. Not
every wants to make it look like they're using twisted, even if they
are. Having a twistd process appear in my process list is unacceptable,
and my applications takes a well know and singular config. Twistd should
be nothing more than a general helper.

 

Ultimately what Mikhail shows is very similar to what I have done by
import directly the ApplicationRunner I want to use (my app is also
Unix-only), and then subclassing ServerOptions. I also modified
createorGetApplication to return an application object instead  of
loading it from some damned .tac file that is passed in on the CLI,
which was exactly the thing that was trying to be avoided. My
application is defined already in code, so I should be able to create my
application object, and pass it right into a runner with proper
application options and have it fire up avoiding the generalities of
twistd that don't apply to me. Again, twistd is great at supporting one
use case. It needs to support others, and it needs to be refactored just
a bit more to do that. It wouldn't be as difficult to do this as you
probably imagine, and proper documentation on more ways it could be used
would save developers a ton of time. Now, if I only had the time to get
this done I'll see if I can refactor and provide some sample code to
at serves the use case we are discussing here. As I was told early on in
this inquiry, this problem isn't an uncommon complaint, so solving it
seems useful.

 

-Jared

 

From: twisted-python-boun...@twistedmatrix.com
[mailto:twisted-python-boun...@twistedmatrix.com] On Behalf Of Paul
Thomas
Sent: Friday, July 03, 2009 2:31 AM
To: Twisted general discussion
Subject: Re: [Twisted-Python] untwisting twistd

 

 

On 2 Jul 2009, at 23:50, Mikhail wrote:






In my example I should have written 

   run(application)

instead of 

   run(...)

Then the difference would be more apparent. Namely, in my 'wrapper'
it is explicit what application will be run and where all the services
came from, your 'wrapper' is just a customized version of twistd and 
what will be run depends on the command line and what will be found 
in the file system. In some cases I'd like to _explicitly_ code into 
main script what functionality my application provides and I do not
want twistd search file system for plugins at all.

 

I'm not using plugins, but I had the same requirement as you to
explicitly create the app and then run it - because I need the freeze
scripts to make a single application.

 

My solution looked something like:

 

# myapp.py

 

from twisted.scripts._twistd_unix import UnixApplicationRunner

# Of course, that's just because the app is unix only

 

 

class MyRunner(UnixApplicationRunner):

def createOrGetApplication(self):

# The stuff that's usually in a tac file

application = # ...

return application

 

def main():

setup_logging()

config = { # stuff pinched by dumping 'config' during a
twistd run

}

# Also do the ServerOptions thing here if necessary

MyRunner(config).run()

 

if __name__ == '__main__'

main()

 

 

 

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