import zmq

from .databases import Databases
from .worker import Worker

context = zmq.Context()

back_uri = 'inproc://workers'

proxy = zmq.devices.ThreadDevice(
    device_type=zmq.QUEUE, in_type=zmq.DEALER, out_type=zmq.ROUTER
)
proxy.bind_out('tcp://*:4224')
proxy.bind_in(back_uri)
proxy.start()

databases = Databases('dbs')

nb_workers = 8
workers = []

for i in range(nb_workers):
    worker = Worker(databases, back_uri)
    worker.daemon = True
    worker.start()
    workers.append(worker)

while proxy.launcher.isAlive():
    try:
        # If we join the process without a timeout we never
        # get the chance to handle the exception
        proxy.join(100)
    except KeyboardInterrupt:
        databases.close()
        break

@@ -1,12 +1,29 @@
+import argparse%0A%0A
 import zmq%0A%0A
@@ -83,16 +83,196 @@
 Worker%0A%0A
+%0Aparser = argparse.ArgumentParser(%22escalator%22)%0Aparser.add_argument(%0A    '--bind', default='tcp://*:4224',%0A    help=%22Address to bind escalator server%22%0A)%0Aargs = parser.parse_args()%0A%0A
 context 
@@ -437,30 +437,25 @@
 ind_out(
-'tcp://*:4224'
+args.bind
 )%0Aproxy.
@@ -487,16 +487,82 @@
 tart()%0A%0A
+print('Starting escalator server on %7B%7D'.format(repr(args.bind)))%0A%0A
 database

Use command-line argument to bind server address