def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz_bucket c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT, pb_port=PB_PORT) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if (not SKIP_SEARCH and not RUN_YZ): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search() if RUN_YZ: c.protocol = 'pbc' testrun_yz_bucket = 'yzbucket' c.create_search_index(testrun_yz_bucket) b = c.bucket(testrun_yz_bucket) index_set = False while not index_set: try: b.set_property('search_index', testrun_yz_bucket) index_set = True except RiakError: pass
def tearDownModule(): c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT) if not SKIP_SEARCH and not RUN_YZ: b = c.bucket(testrun_search_bucket) b.clear_properties() b = c.bucket(testrun_sibs_bucket) b.clear_properties() b = c.bucket(testrun_props_bucket) b.clear_properties()
def tearDownModule(): c = RiakClient(transport='http', http_port=HTTP_PORT) if not int(os.environ.get('SKIP_SEARCH', '0')): b = c.bucket(testrun_search_bucket) b.clear_properties() b = c.bucket(testrun_sibs_bucket) b.clear_properties() b = c.bucket(testrun_props_bucket) b.clear_properties()
def tearDownModule(): c = RiakClient(protocol="http", host=HTTP_HOST, http_port=HTTP_PORT) if not int(os.environ.get("SKIP_SEARCH", "0")): b = c.bucket(testrun_search_bucket) b.clear_properties() b = c.bucket(testrun_sibs_bucket) b.clear_properties() b = c.bucket(testrun_props_bucket) b.clear_properties()
def tearDownModule(): c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT) if not int(os.environ.get('SKIP_SEARCH', '0')) and not int(os.environ.get('RUN_YZ', '1')): b = c.bucket(testrun_search_bucket) b.clear_properties() b = c.bucket(testrun_sibs_bucket) b.clear_properties() b = c.bucket(testrun_props_bucket) b.clear_properties()
def tearDownModule(): c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT) if not int(os.environ.get('SKIP_SEARCH', '0')): b = c.bucket(testrun_search_bucket) b.clear_properties() b = c.bucket(testrun_sibs_bucket) b.clear_properties() b = c.bucket(testrun_props_bucket) b.clear_properties()
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, testrun_sibs_bucket c = RiakClient(protocol="http", host=HTTP_HOST, http_port=HTTP_PORT) testrun_props_bucket = "propsbucket" testrun_sibs_bucket = "sibsbucket" c.bucket(testrun_sibs_bucket).allow_mult = True if not int(os.environ.get("SKIP_SEARCH", "0")): testrun_search_bucket = "searchbucket" b = c.bucket(testrun_search_bucket) b.enable_search()
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if not int(os.environ.get('SKIP_SEARCH', '0')): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search()
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if not int(os.environ.get('SKIP_SEARCH', '0')) and not int(os.environ.get('RUN_YZ', '1')): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search()
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if (not SKIP_SEARCH and not RUN_YZ): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search()
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz, testrun_yz_index, testrun_yz_mr c = RiakClient(host=PB_HOST, http_port=HTTP_PORT, pb_port=PB_PORT, credentials=SECURITY_CREDS) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if (not SKIP_SEARCH and not RUN_YZ): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search() if RUN_YZ: # YZ index on bucket of the same name testrun_yz = {'btype': None, 'bucket': 'yzbucket', 'index': 'yzbucket'} # YZ index on bucket of a different name testrun_yz_index = { 'btype': None, 'bucket': 'yzindexbucket', 'index': 'yzindex' } # Add bucket and type for Search 2.0 -> MapReduce testrun_yz_mr = { 'btype': 'pytest-mr', 'bucket': 'mrbucket', 'index': 'mrbucket' } for yz in (testrun_yz, testrun_yz_index, testrun_yz_mr): c.create_search_index(yz['index']) if yz['btype'] is not None: t = c.bucket_type(yz['btype']) b = t.bucket(yz['bucket']) else: b = c.bucket(yz['bucket']) # Keep trying to set search bucket property until it succeeds index_set = False while not index_set: try: b.set_property('search_index', yz['index']) index_set = True except RiakError: pass
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz, testrun_yz_index, testrun_yz_mr c = RiakClient(host=PB_HOST, http_port=HTTP_PORT, pb_port=PB_PORT, credentials=SECURITY_CREDS) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if (not SKIP_SEARCH and not RUN_YZ): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search() if RUN_YZ: # YZ index on bucket of the same name testrun_yz = {'btype': None, 'bucket': 'yzbucket', 'index': 'yzbucket'} # YZ index on bucket of a different name testrun_yz_index = {'btype': None, 'bucket': 'yzindexbucket', 'index': 'yzindex'} # Add bucket and type for Search 2.0 -> MapReduce testrun_yz_mr = {'btype': 'pytest-mr', 'bucket': 'mrbucket', 'index': 'mrbucket'} for yz in (testrun_yz, testrun_yz_index, testrun_yz_mr): c.create_search_index(yz['index']) if yz['btype'] is not None: t = c.bucket_type(yz['btype']) b = t.bucket(yz['bucket']) else: b = c.bucket(yz['bucket']) # Keep trying to set search bucket property until it succeeds index_set = False while not index_set: try: b.set_property('search_index', yz['index']) index_set = True except RiakError: pass
def setUpModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz_bucket, testrun_mr_btype, \ testrun_mr_bucket c = RiakClient(protocol='pbc', host=PB_HOST, http_port=HTTP_PORT, pb_port=PB_PORT, credentials=SECURITY_CREDS) testrun_props_bucket = 'propsbucket' testrun_sibs_bucket = 'sibsbucket' c.bucket(testrun_sibs_bucket).allow_mult = True if (not SKIP_SEARCH and not RUN_YZ): testrun_search_bucket = 'searchbucket' b = c.bucket(testrun_search_bucket) b.enable_search() if RUN_YZ: c.protocol = 'pbc' testrun_yz_bucket = 'yzbucket' c.create_search_index(testrun_yz_bucket) b = c.bucket(testrun_yz_bucket) index_set = False while not index_set: try: b.set_property('search_index', testrun_yz_bucket) index_set = True except RiakError: pass # Add bucket and type for Search -> MapReduce testrun_mr_btype = 'pytest-mr' testrun_mr_bucket = 'mrbucket' c.create_search_index(testrun_mr_bucket, '_yz_default') t = c.bucket_type(testrun_mr_btype) b = t.bucket(testrun_mr_bucket) index_set = False while not index_set: try: b.set_property('search_index', testrun_mr_bucket) index_set = True except RiakError: pass
def tearDownModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz_bucket c = RiakClient(host=HTTP_HOST, http_port=HTTP_PORT, pb_port=PB_PORT, credentials=SECURITY_CREDS) c.bucket(testrun_sibs_bucket).clear_properties() c.bucket(testrun_props_bucket).clear_properties() if not SKIP_SEARCH and not RUN_YZ: b = c.bucket(testrun_search_bucket) b.clear_properties() if RUN_YZ: for yz in (testrun_yz, testrun_yz_index, testrun_yz_mr): if yz['btype'] is not None: t = c.bucket_type(yz['btype']) b = t.bucket(yz['bucket']) else: b = c.bucket(yz['bucket']) b.set_property('search_index', '_dont_index_') c.delete_search_index(yz['index']) for keys in b.stream_keys(): for key in keys: b.delete(key)
def tearDownModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz_bucket c = RiakClient(host=HTTP_HOST, http_port=HTTP_PORT, pb_port=PB_PORT, credentials=SECURITY_CREDS) c.bucket(testrun_sibs_bucket).clear_properties() c.bucket(testrun_props_bucket).clear_properties() if not SKIP_SEARCH and not RUN_YZ: b = c.bucket(testrun_search_bucket) b.clear_properties() if RUN_YZ: yzbucket = c.bucket(testrun_yz_bucket) yzbucket.set_property('search_index', '_dont_index_') c.delete_search_index(testrun_yz_bucket) for keys in yzbucket.stream_keys(): for key in keys: yzbucket.delete(key) mrtype = c.bucket_type(testrun_mr_btype) mrbucket = mrtype.bucket(testrun_mr_bucket) mrbucket.set_property('search_index', '_dont_index_') c.delete_search_index(testrun_mr_bucket) for keys in mrbucket.stream_keys(): for key in keys: mrbucket.delete(key)
def tearDownModule(): global testrun_search_bucket, testrun_props_bucket, \ testrun_sibs_bucket, testrun_yz_bucket c = RiakClient(protocol='http', host=HTTP_HOST, http_port=HTTP_PORT, pb_port=PB_PORT) c.bucket(testrun_sibs_bucket).clear_properties() c.bucket(testrun_props_bucket).clear_properties() if not SKIP_SEARCH and not RUN_YZ: b = c.bucket(testrun_search_bucket) b.clear_properties() if RUN_YZ: c.protocol = 'pbc' yzbucket = c.bucket(testrun_yz_bucket) yzbucket.set_property('search_index', '_dont_index_') c.delete_search_index(testrun_yz_bucket) for keys in yzbucket.stream_keys(): for key in keys: yzbucket.delete(key)
data = r.data if data != i: raise if __name__ == '__main__': # master_version client = RiakClient(host='219.224.135.60', pb_port=10017, protocol='pbc') # master_version use nodes param # 此场景下性能差不多,和上面指定具体port相比 # client = RiakClient(host='219.224.135.60', nodes=Nodes, protocol='pbc') # test test_bucket = client.bucket('lijun_test') """ new_node = test_bucket.new('hehe', data='hehe') new_node.store() r = test_bucket.get('hehe') print r.get_data(), type(r.get_data()) new_node = test_bucket.new('hehe1', data=1) new_node.store() r = test_bucket.get('hehe1') print r.get_data(), type(r.get_data()) """ # test performance """ n = 100000 test_riak_write(test_bucket, n)
# master_version data = r.data if data != i: raise if __name__ == '__main__': # master_version client = RiakClient(host='219.224.135.60', pb_port=10017, protocol='pbc') # master_version use nodes param # 此场景下性能差不多,和上面指定具体port相比 # client = RiakClient(host='219.224.135.60', nodes=Nodes, protocol='pbc') # test test_bucket = client.bucket('lijun_test') """ new_node = test_bucket.new('hehe', data='hehe') new_node.store() r = test_bucket.get('hehe') print r.get_data(), type(r.get_data()) new_node = test_bucket.new('hehe1', data=1) new_node.store() r = test_bucket.get('hehe1') print r.get_data(), type(r.get_data()) """ # test performance """ n = 100000 test_riak_write(test_bucket, n)