Created
January 29, 2014 20:32
-
-
Save shuhaowu/8696406 to your computer and use it in GitHub Desktop.
Purges all keys from riak via python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import riak | |
import multiprocessing | |
keys = [] | |
c = riak.RiakClient() | |
for b in c.get_buckets(): | |
k = [(b.name, key) for key in b.get_keys()] | |
keys.extend(k) | |
print len(keys) | |
def f(args): | |
c = riak.RiakClient() | |
b, key = args | |
print "Deleting", key, b, multiprocessing.current_process() | |
c.bucket(b).delete(key) | |
pool = multiprocessing.Pool() | |
pool.map_async(f, keys, 100) | |
pool.close() | |
pool.join() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment