Workers and Connections¶
The Toto worker and worker connection classes are designed to help build RPC systems, allowing you to pass CPU intensive work to other processeses or machines. Workers were originally designed for use with the Toto server, making it easy to perform long running tasks without effecting the server’s responsiveness, but they have been designed to be used independently and have no direct ties to the web server architecture.
TotoWorkers and WorkerConnections use ZMQ for messaging and require the pyzmq module.
The TotoWorkerService has a built in message router that will round-robin balance incoming messages. The router can be disabled through configuration if only one worker process is needed. Alternatively, the router can be configured to run without any worker processes, allowing multiple machines to share a common router.
Most of the time you’ll only need this script to start your server:
from toto.worker import TotoWorkerService
TotoWorkerService('settings.conf').run()
Methods, startup functions and databases can all be configured with the conf file.
Run your startup script with –help to see all available options.