On Mon, Nov 08, 2010 at 01:50:38PM -0500, Neal Becker wrote:
> I seem to have things working OK with twistd.
> 
> My app is a batch scheduling system that listens for commands via xmlrpc.  
> It is very simple at this point, and I'm attaching it.  I would welcome any 
> suggestions for improvement, since I'm a newb to twisted, and a lot of this 
> was guesswork.
> 
> task.py is a seperate file because otherwise pickle doesn't work.  t6.tac is 
> the server, and a toy client is client4.py.

If I could you give a suggestion on how to structure the server side of
your program:

The ``Task`` class in a separate file, this is fine, clients could
import the file without the need to import the non useful, for the
client, server code.

All the server logic in a file and a third file for the tap, here a
possible structure:

        procxmlrpc/
                |- client.py
                |- server.py
                `- task.py
        twisted/
                `- plugins/
                        `- procxmlrpc_plugin.py

Here the simplified code, all the remaining code goes into ``server.py``

        from procxmlrpc.server import Spawner

        from twisted.web import server
        from twisted.application import service, internet

        application = service.Application("Demo application")
        spawn_server = server.Site(Spawner())
        service = internet.TCPServer(7080, spawn_server)
        service.setServiceParent(application)

m.


-- 
Nessuno come me si è creato una società reale evocando delle ombre; al
punto che la vita dei miei ricordi assorbe il sentimento della mia
vita reale.
                                -- René de Chateaubriand, Mémoires d'Outre-tombe

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

Reply via email to