From: Michael Vrable Date: Mon, 19 Sep 2011 06:09:44 +0000 (-0700) Subject: Make cleaner cache persistent across runs X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=5551523de35c1abaf24d77654928e2c748fd95aa;p=bluesky.git Make cleaner cache persistent across runs --- diff --git a/cleaner/cleaner b/cleaner/cleaner index 93feef4..60c91f5 100755 --- a/cleaner/cleaner +++ b/cleaner/cleaner @@ -96,6 +96,9 @@ class S3Backend(Backend): self.path = path self.cachedir = cachedir self.cache = {} + for f in os.listdir(cachedir): + self.cache[f] = True + print "Initial cache contents:", list(self.cache.keys()) self.connect() self.stats_get = [0, 0] self.stats_put = [0, 0] @@ -466,7 +469,7 @@ class InodeMap: print "%s: %s %s" % (s, u, float(u[1]) / u[0]) if u[1] == 0: print "Would delete..." - #backend.delete(s) + backend.delete(s) deletions[0] += 1 deletions[1] += u[0] @@ -586,7 +589,7 @@ def run_cleaner(backend, inode_map, log, repack_inodes=False): if __name__ == '__main__': start_time = time.time() - backend = S3Backend("mvrable-bluesky-west", cachedir="/export/cache") + backend = S3Backend("mvrable-bluesky-west", cachedir="/tmp/bluesky-cache") #backend = FileBackend(".") chkpt = load_checkpoint_record(backend) print backend.list()