[Twisted-Python] delay_connect problems in twisted.enterprise.adbapi

Hello, I'm having a problem using twisted.enterprise.adbapi. The problem has to do with the 'delay_connect' option I send with my db connection kwargs. I want to send sybase connection appname and hostname info. The only way I can do this is using the delayed connect option. I have the following standalone program example that works just fine: vrdb = vr_db('billing_db', 'appname') # vr_db just is a helper class for logical dbname -> db connection info db_kwargs = vrdb.return_kwargs() db_kwargs['cp_min'] = 1 # one thread min db_kwargs['cp_max'] = 1 # one thread max = only one db connection db_kwargs['cp_reconnect'] = 1 # reconnect if die db_kwargs['cp_noisy'] = 1 db_kwargs['delay_connect'] = 1 # do the delayed connect db_kwargs['cp_openfun'] = vrdb._vrdbOptions print db_kwargs dbpool = adbapi.ConnectionPool(vrdb.return_import_name(), **db_kwargs) # _vrdbOptions adds the following two things to the connection # conn.set_property (Sybase.CS_HOSTNAME, self.hostname) # conn.set_property(Sybase.CS_APPNAME, self.appname) a = storage(dbpool, d) a.run() reactor.run() run does a sql query. def run(self): ''' utility method if the script is called directly ''' self.get_campaign_info('id', 588103).addCallback( self.print_result ).addErrback(self.error_happened) This works fine and dandy. With the hostname and appname showing up in my sp_who optput (show's you who's logged in from where with what appname ) Now my problem is when I use the database connection part in makeService(config) and pass a dbpool to a service, my service starts up fine, but when I have a database operation I get this: 2006/12/07 15:46:17 PST [-] [Failure instance: Traceback: twisted.enterprise.adbapi.ConnectionLost: /usr/lib/python2.4/threading.py:422:run /usr/lib/python2.4/site-packages/twisted/python/threadpool.py:148:_worker /usr/lib/python2.4/site-packages/twisted/python/context.py:59:callWithContext /usr/lib/python2.4/site-packages/twisted/python/context.py:37:callWithContext --- <exception caught here> --- /usr/lib/python2.4/site-packages/twisted/internet/threads.py:25:_putResultInDeferred /usr/lib/python2.4/site-packages/twisted/enterprise/adbapi.py:379:_runInteraction /usr/lib/python2.4/site-packages/twisted/enterprise/adbapi.py:64:rollback ] So I've reverted my code to pass db_kwargs['delay_connect'] = 0 and it's working fine as long as I don't try the delay_connect. I'm hoping someone has seen this before and can point me in the right direction. I'd really like to have my appname and hostname show up on the db side. I'm using twisted, sybase 12.5, and the most recent Sybase module. The only difference is the way I'm connecting is one program is a tap created from mktap and the other a standalone script.
Thanks -rob
participants (1)
-
Rob Hoadley