async def destroy_table(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) while True: try: table = "huobi.btc.usdt.1m" await client.destroy_table(table) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)
async def get_tables(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) while True: try: names, ids = await client.get_tables() logger.info("Received names: %s, ids: %s", names, ids) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)
async def set_rows(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) global count while True: try: keys, values = build_rows() await client.set_rows("huobi.btc.usdt.1m", keys, values) count += 1 if count % 1000 == 0: logger.info("count: %s", count) except Exception: logger.error("Failed to check: %s", traceback.format_exc())
async def get_nth_last_value(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) global count while True: try: table = "huobi.btc.usdt.1m" value = await client.get_nth_last_value(table, 0) logger.info("Received value: %s", value) count += 1 if count % 1000 == 0: logger.info("count: %s", count) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)
async def get_boundary_rows(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) global count while True: try: table = "huobi.btc.usdt.1m" rows = await client.get_boundary_rows(table) logger.info("Received rows: %s", rows) count += 1 if count % 1000 == 0: logger.info("count: %s", count) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)
async def delete_rows_since(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) global count while True: try: table = "huobi.btc.usdt.1m" key = struct.pack('>I', 2) await client.delete_rows_since(table, key, 2) break count += 1 if count % 1000 == 0: logger.info("count: %s", count) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)
async def get_values_until(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) global count while True: try: table = "huobi.btc.usdt.1m" key = struct.pack('>I', 3) values = await client.get_values_until(table, key, 10) logger.info("Received values: %s", values) count += 1 if count % 1000 == 0: logger.info("count: %s", count) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)
async def get_rows_between(): loop = asyncio.get_event_loop() client = Client("localhost:8888", loop=loop) global count while True: try: table = "huobi.btc.usdt.1m" begin_key = struct.pack('>I', 3) end_key = struct.pack('>I', 11) keys, values = await client.get_rows_between( table, begin_key, end_key, 3) logger.info("Received keys: %s, values: %s", keys, values) count += 1 if count % 1000 == 0: logger.info("count: %s", count) except Exception: logger.error("Failed to check: %s", traceback.format_exc()) await asyncio.sleep(1)