def load_from_file(path, **kw): try: kw = bootstrap.setup(**kw) except Exception as e: raise e else: # initialize the redis connection redis_conn = kw.get("redis_conn") # first unpickle the file into a list of objects dump_data = pickle.load(open(path, "rb")) for key in dump_data: load_key(key, redis_conn) bootstrap.breakdown(**kw)
def dump(**kw): try: # set up the connection wit the passed parameters kw = bootstrap.setup(**kw) except Exception as e: raise e else: redis_conn = kw.get("redis_conn") dump_data = [] # now loop through each key and remove from the database for key in redis_conn.keys(): dump_data.append(get_key(key, redis_conn)) # breakdown test environment here bootstrap.breakdown(**kw) return dump_data