Example #1
0
        else:
            result = SnapshotService.get_response(self, request)
        return result


if __name__ == "__main__":
    # Read config info
    config = ConfigParser.ConfigParser()
    config.readfp(open('config.ini'))

    # Ask ratchet hub for instance info
    team = config.get('Team', 'name')
    hub_host = config.get('Ratchet Hub', 'host')
    hub_port = int(config.get('Ratchet Hub', 'port'))

    ratchet_hub = RatchetHub(hub_host, hub_port)
    instance_config = ratchet_hub.get_qplan_instance_config(team)
    header_file_map = ratchet_hub.get_header_file_map("Team Data Files")
    ratchet_hub_info = ratchet_hub.get_ratchet_hub_info()

    # The config file is configured from the client's perspective, so the
    # SnapshotService's reply port is the client's request port.
    reply_port = instance_config['req_port']
    publish_port = instance_config['sub_port']
    working_directory = "."
    name = "%s/%s/SnapshotService" % (ratchet_hub_info['org_name'], team)

    service = TeamSnapshotService(name, header_file_map, working_directory,
                               reply_port, publish_port, ratchet_hub)
    service.run()
        else:
            result = SnapshotService.get_response(self, request)
        return result


if __name__ == "__main__":
    # Read config info
    config = ConfigParser.ConfigParser()
    config.readfp(open('config.ini'))

    # Ask ratchet hub for instance info
    hub_host = config.get('Ratchet Hub', 'host')
    hub_port = int(config.get('Ratchet Hub', 'port'))

    ratchet_hub = RatchetHub(hub_host, hub_port)
    header_file_map = ratchet_hub.get_header_file_map("Vantage Data Files")
    ratchet_hub_info = ratchet_hub.get_ratchet_hub_info()

    # The config file is configured from the client's perspective, so the
    # SnapshotService's reply port is the client's request port.
    vantage_info = ratchet_hub.get_vantage_config()
    reply_port = int(vantage_info['snapshot_req_port'])
    publish_port = int(vantage_info['snapshot_sub_port'])

    working_directory = "."
    name = "%s/VantageSnapshotService" % (ratchet_hub_info['org_name'])

    service = VantageSnapshotService(name, header_file_map, working_directory,
                               reply_port, publish_port, ratchet_hub)
    service.run()