From 5675b4e7e0d6f71dc21756c12f0876be496e4c46 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sat, 7 Mar 2009 16:14:42 -0700 Subject: [PATCH] expirer: make web display a bit more consistent --- src/allmydata/storage/expirer.py | 2 ++ src/allmydata/test/test_storage.py | 16 ++++++++-------- src/allmydata/web/storage.py | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/allmydata/storage/expirer.py b/src/allmydata/storage/expirer.py index 0579135a..42691b06 100644 --- a/src/allmydata/storage/expirer.py +++ b/src/allmydata/storage/expirer.py @@ -149,6 +149,8 @@ class LeaseCheckingCrawler(ShareCrawler): so_far = self.state["cycle-to-date"] self.increment(so_far["leases-per-share-histogram"], num_leases, 1) so_far["shares-examined"] += 1 + # TODO: accumulate share-sizes too, so we can display "the whole + # cycle would probably recover x GB out of y GB total" would_keep_share = [1, 1, 1] diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py index 7ccd2ec7..82dfa609 100644 --- a/src/allmydata/test/test_storage.py +++ b/src/allmydata/test/test_storage.py @@ -1618,15 +1618,15 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): self.failUnlessIn("So far, this cycle has examined " "1 shares in 1 buckets " "and has recovered: " - "0 buckets, 0 shares, 0 B ", s) + "0 shares, 0 buckets, 0 B ", s) self.failUnlessIn("If expiration were enabled, " "we would have recovered: " - "0 buckets, 0 shares, 0 B by now", s) + "0 shares, 0 buckets, 0 B by now", s) self.failUnlessIn("and the remainder of this cycle " "would probably recover: " - "0 buckets, 0 shares, 0 B ", s) + "0 shares, 0 buckets, 0 B ", s) self.failUnlessIn("and the whole cycle would probably recover: " - "0 buckets, 0 shares, 0 B ", s) + "0 shares, 0 buckets, 0 B ", s) self.failUnlessIn("if we were using each lease's default " "31-day lease lifetime", s) self.failUnlessIn("this cycle would be expected to recover: ", s) @@ -1686,7 +1686,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): d.addCallback(lambda ign: self.render1(webstatus)) def _check_html(html): s = remove_tags(html) - self.failUnlessIn("recovered: 0 buckets, 0 shares, 0 B " + self.failUnlessIn("recovered: 0 shares, 0 buckets, 0 B " "but expiration was not enabled", s) d.addCallback(_check_html) return d @@ -1779,10 +1779,10 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): # all. This part of the test depends upon the SIs landing right # where they do now. self.failUnlessIn("The remainder of this cycle is expected to " - "recover: 5 buckets, 5 shares", s) + "recover: 5 shares, 5 buckets", s) self.failUnlessIn("The whole cycle is expected to examine " "6 shares in 6 buckets and to recover: " - "6 buckets, 6 shares", s) + "6 shares, 6 buckets", s) d.addCallback(_check_html_in_cycle) # wait for the crawler to finish the first cycle. Two shares should @@ -1833,7 +1833,7 @@ class LeaseCrawler(unittest.TestCase, pollmixin.PollMixin, WebRenderingMixin): def _check_html(html): s = remove_tags(html) self.failUnlessIn("Expiration Enabled: expired leases will be removed", s) - self.failUnlessIn(" recovered: 2 buckets, 2 shares, ", s) + self.failUnlessIn(" recovered: 2 shares, 2 buckets, ", s) d.addCallback(_check_html) return d diff --git a/src/allmydata/web/storage.py b/src/allmydata/web/storage.py index 686e92af..0549bc57 100644 --- a/src/allmydata/web/storage.py +++ b/src/allmydata/web/storage.py @@ -139,8 +139,8 @@ class StorageStatus(rend.Page): return "?" return "%d" % d space = abbreviate_space(sr["%s-diskbytes" % a]) - return "%s buckets, %s shares, %s" % (maybe(sr["%s-numbuckets" % a]), - maybe(sr["%s-numshares" % a]), + return "%s shares, %s buckets, %s" % (maybe(sr["%s-numshares" % a]), + maybe(sr["%s-numbuckets" % a]), space) def render_lease_current_cycle_progress(self, ctx, data): -- 2.45.2