Пример #1
0
def main():
    args = parse_options()

    for port in args.ports:
        client = Recommender(args.host, int(port), args.name)
        try:
            result = client.get_all_rows()
            logging.info('{0}:{1} ... {2}'.format(args.host, port, result))
        except:
            logging.exception('{0}:{1}'.format(args.host, port))
Пример #2
0
def main():
    args = parse_options()

    for port in args.ports:
        client = Recommender(args.host, int(port), args.name)
        d = Datum({'key': 1.0})
        try:
            result = client.update_row(args.id, d)
            logging.info('{0}:{1} ... {2}'.format(args.host, port, result))
        except:
            logging.exception('{0}:{1}'.format(args.host, port))
Пример #3
0
    def setUp(self):
        self.config = {
            "method": "inverted_index",
            "converter": {
                "string_filter_types": {},
                "string_filter_rules": [],
                "num_filter_types": {},
                "num_filter_rules": [],
                "string_types": {},
                "string_rules": [{"key": "*", "type": "str", "sample_weight": "bin", "global_weight": "bin"}],
                "num_types": {},
                "num_rules": [{"key": "*", "type": "num"}]
                },
            "parameter": {}
            }

        TestUtil.write_file('config_recommender.json', json.dumps(self.config))
        self.srv = TestUtil.fork_process('recommender', port, 'config_recommender.json')
        try:
            self.cli = Recommender(host, port, "name")
        except:
            TestUtil.kill_process(self.srv)
            raise