def __init__(self, push_addr, sub_addr): super(ComputerProcess, self).__init__() self.push_addr = push_addr self.sub_addr = sub_addr self.push_stream = None self.sub_stream = None self.status = status.ComputerStatus(config.ELECTION_CODE) self.logger = helpers.get_logger('computer')
urls = ( '/', 'index', '/computation/?', 'compute', '/coordinate_partiti/(\w+)/?', 'coordinates', ) if config.DEBUG: urls += ('/configuration/?','configuration') web.config.debug = config.DEBUG app = web.application(urls, globals()) current_status = status.ComputerStatus(config.ELECTION_CODE) logger = helpers.get_logger('computer') logger.debug("status path: " + config.STATUS_PATH) logger.debug("election code: " + config.ELECTION_CODE) def start_computer_proc(): """ starts the process that can receive and reply to config messages config messages are received on a PUB_SUB channel (sent manually on a server), reply messages contain the configuration and are sent through a PUSH_PULL channel the process lives with the application """ computer = computer_proc.ComputerProcess(config.PUSH_ADDR, config.SUB_ADDR) computer.start()