[Twisted-Python] strange twistd behaviour

Stéphane Brault stephane_brault at yahoo.fr
Fri Jul 28 10:53:42 EDT 2006


Hi,
 It seems that the problem comes from my databaseBroker objet which inherits from the AccessBroker class
 from the sasync library which does'nt seem to fire startup when run as a daemon process. It therefore doesn't
 has anything to do with twistd per se. Sorry to pollute this mailing list with irrelevant posts ;-)
 
 Stéphane
 
 
 ----- Message d'origine ----
De : Stéphane Brault <stephane_brault at yahoo.fr>
À : twisted-python at twistedmatrix.com
Envoyé le : Mercredi, 26 Juillet 2006, 2h58mn 01s
Objet : [Twisted-Python] strange twistd behaviour

Hi,
 I created a twisted server but when I run it with twistd I don't get the same behaviour
 that I get when I use reactor.run()
 Here what I do with reactor:
 
 import communication.update
  import communication.updateXMLRPC
 from twisted.internet import reactor
  from twisted.web import resource, server as webserver
  
  communications = communication.update.communications("mysql://....")
  comXMLRPC = communication.updateXMLRPC.communicationsXMLRPC(communications)
  rootResource = resource.Resource()
  rootResource.putChild('RPC2', comXMLRPC)
 reactor.listenTCP(8000, webserver.Site(rootResource))
 reactor.run()
 
 
 Here is the server:
 
 import communication.update
 import communication.updateXMLRPC
 from twisted.application import service, internet
 from twisted.web import resource, server as webserver
 
 communications = communication.update.communications("mysql://....")
 comXMLRPC = communication.updateXMLRPC.communicationsXMLRPC(communications)
 rootResource = resource.Resource()
 rootResource.putChild('RPC2', comXMLRPC)
 webService = internet.TCPServer(8000, webserver.Site(rootResource))
 webService.setName('web')
 application = service.Application('communication')
 webService.setServiceParent(application)
 
 The communications class looks like that:
 
 class communications(object):
     
     def __init__(self, url):
         self.databaseReady = False
         self.databaseBroker = DatabaseBroker(url)
         d = self.databaseBroker.startup()  #line 1
         d.addCallback(self.serverReady).addErrback(self.serverError) #line 2
         
         
     def serverReady(self, result):
         self.databaseReady = True
 
     def serverError(self, error):
 ....
 
 The server works fine on WinXP, the code with the reactor works fine everywhere but the server, called by twistd -y /../server.py,
 starts but has problems with line 1 and line 2 (doesn't seem to call them) on my debian distribution (3.1).
 Any hints ?
 
 Thanks,
 
 Stéphane



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







More information about the Twisted-Python mailing list