def test_run_admin_garbage_collection(): rdz = Rediz(**REDIZ_TEST_CONFIG) rdz.admin_garbage_collection() names = rdz._names() if names: report = rdz._size(name=names[0], with_report=True) dump(report)
def test_admin_garbage_collection(num=100): rdz = Rediz(**REDIZ_TEST_CONFIG) original_num = rdz.card() names = [rdz.random_name() for _ in range(num)] write_keys = [BELLEHOOD_BAT for _ in names] values = ["from test_admin_garbage_collection" for _ in write_keys] budgets = [1 for _ in range(num)] mset_res = rdz.mset(names=names, write_keys=write_keys, values=values, budgets=budgets) assert len(mset_res) == len(names) expire_pipe = rdz.client.pipeline() for name in names: expire_pipe.expire(name=name, time=0) expire_pipe.execute() time.sleep(0.15) remaining = list() for iter_no in range(5): rdz.admin_garbage_collection(fraction=0.01) remaining.append(rdz.card()) final_num = rdz.card() rdz._delete_implementation(*names)
import time from rediz.collider_config_private import REDIZ_COLLIDER_CONFIG from rediz.client import Rediz if __name__ == '__main__': rdz = Rediz(**REDIZ_COLLIDER_CONFIG) HOURS = 10 for k in range(60 * 60 * 2 * HOURS): time.sleep(0.5) garbage_before = time.time() rdz.admin_garbage_collection() garbage_after = time.time() print("Garbage collection took " + str(garbage_after - garbage_before) + " seconds.")
def test_trash(): rdz = Rediz(**REDIZ_TEST_CONFIG) rdz.admin_garbage_collection()