def main():
config = get_inventory_configuration()
logging.basicConfig(level=logging.getLevelName(config.log_level),
format=config.log_format)
loop = zmq.asyncio.ZMQEventLoop()
loop.set_debug(config.asyncio_debug)
asyncio.set_event_loop(loop)
s = InventoryServer(bind_address=config.inventory.bind_address,
config=config)
try:
loop.run_until_complete(s.start())
except KeyboardInterrupt:
log.info('Stopping service')
s.kill()
finally:
pending = asyncio.Task.all_tasks(loop=loop)
loop.run_until_complete(asyncio.gather(*pending))
loop.close()
评论列表
文章目录