Re: [Twisted-Python] Comparing "Stackless Python + Nonblocking Stackless Modules" with Twisted.

2010-05-09 Thread Peter Cai
On Mon, May 10, 2010 at 8:17 AM, Andrew Francis wrote: > Hi Peter: > I think things get more complex when one is dealing with multiple end-points > in sequence (now callbacks are chained) or one is using iterators > (cooperators/coiterators now needed?). What light-weight threads do is make >

[Twisted-Python] Comparing "Stackless Python + Nonblocking Stackless Modules" with Twisted.

2010-05-09 Thread Peter Cai
Today, a guy gave me an URL http://code.google.com/p/stacklessexamples/wiki/StacklessNonblockModules It's a replacement of standard python socket module. What make it different is that this module only blocks a tasklet, not an entire Python thread. With this module and stackless python, theoretic

Re: [Twisted-Python] My twisted application could not start after reboot be cause of "twistd.pid"

2010-03-16 Thread Peter Cai
Mar 15, 2010 at 06:32:23PM +0800, Peter Cai wrote: > > Someone turn off the server by cutting power of the server. > > When the machine is power on, I found my twisted application could not > start > > and emit the following error. > > > > Another twistd server is ru

[Twisted-Python] My twisted application could not start after reboot be cause of "twistd.pid"

2010-03-15 Thread Peter Cai
Someone turn off the server by cutting power of the server. When the machine is power on, I found my twisted application could not start and emit the following error. Another twistd server is running, PID 3398 This could either be a previously started instance of your application or a different a

[Twisted-Python] Using sqlalchemy in twisted.

2009-11-11 Thread Peter Cai
If you Google "sqlalchemy twisted", you can see my post is on the top: http://groups.google.com/group/sqlalchemy/browse_thread/thread/c802749c9d0dd6 I've been busy for a long time so I didn't considered this question anymore. But occasionally, I got some new ideas today. I was suggested to sand

[Twisted-Python] Incorrect "Another twistd server is running..."

2009-07-21 Thread Peter Cai
When my server reboot after an unexpected power cut, supervisord tried to start a twisted app after an unexpected power cut, but it fails because "Another twistd server is running, PID 4607" 4607 is the PID of the twisted app before power cut. After I stopped and restart supervisord, everything is

[Twisted-Python] How to split a huge 'service' class.

2009-03-25 Thread Peter Cai
Hi all, I am writing a network application based on twisted and following the "finger service" tutorial in twisted document. I wrote multiple protocols classes and a single service class. This allows client to choose the most suitable protocol to access services. My problem is : the service class

Re: [Twisted-Python] Using sqlalchemy in twisted.

2009-03-11 Thread Peter Cai
Hi, I've read some mails in this list that recommend use sqlalchemy in separate processes. But if u use multiprocessing which provides only synchronous API, doesn't you have to use deferToThread also? Another way would be using "twisted.internet.protocol.ProcessProtocol", which use pipes. But ca

Re: [Twisted-Python] Using sqlalchemy in twisted.

2009-03-04 Thread Peter Cai
I changed my code to this style, it works again. This code would create a new session on each request and close it immediately. Hope this trick could save me! #= def require_session(f): '''create and close session for each synchronous method''' de

Re: [Twisted-Python] Using sqlalchemy in twisted.

2009-03-04 Thread Peter Cai
;t give up orm as these mapper classes are used everywhere in my application. On Thu, Mar 5, 2009 at 3:04 AM, Valentino Volonghi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > On Mar 4, 2009, at 3:28 AM, Peter Cai wrote: > > The code d

[Twisted-Python] Using sqlalchemy in twisted.

2009-03-04 Thread Peter Cai
Hi, all I am using sqlalchemy in twisted in my project in the way below. Defer any database operation so the twisted's main thread won't be blocked. And I use scoped_session, so that sessions won't have to be created again and again. == class Database() de

Re: [Twisted-Python] SQLAlchemy and Twisted

2009-02-13 Thread Peter Cai
Hi, Thanks for this insightful comments on Sqlalchmy and Twisted. I hope I had read your mail before I start my current project. At that time, I simply thought using deferToThread would solve everything since the twisted.enterprise.adbapi simply use threads.deferToThreadPool to make database in

[Twisted-Python] When would you considering split a server application to some physical instance with different logic function?

2008-12-01 Thread Peter Cai
Hi all, First, I am sorry because it's not a question related to twisted. But since twisted is a networking programming framework, you might be interested. Some of my colleagues have a view that a net work server should be split to small parts with different functions, either with processes comm