From 4a1fc74d6906f9dd20b6d2e55bf8f651eeee6e4d Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Wed, 29 Jul 2009 19:26:12 -0300 Subject: [PATCH] fixed spiderstats webconsole extension --- scrapy/contrib/webconsole/livestats.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scrapy/contrib/webconsole/livestats.py b/scrapy/contrib/webconsole/livestats.py index 0fe8b84f0..7b338ccea 100644 --- a/scrapy/contrib/webconsole/livestats.py +++ b/scrapy/contrib/webconsole/livestats.py @@ -49,28 +49,30 @@ class LiveStats(object): sch = scrapyengine.scheduler dwl = scrapyengine.downloader - totdomains = totscraped = totcrawled = totscheduled = totactive = totpending = 0 + totdomains = totscraped = totcrawled = totscheduled = totactive = totpending = totdqueued = tottransf = 0 s = banner(self) s += "\n" - s += "\n" + s += "\n" for d in sorted(self.domains.keys()): scheduled = len(sch.pending_requests[d]) if d in sch.pending_requests else 0 active = len(dwl.sites[d].active) if d in dwl.sites else 0 - pending = len(dwl.sites[d].queue) if d in dwl.queue else 0 + dqueued = len(dwl.sites[d].queue) if d in dwl.sites else 0 + transf = len(dwl.sites[d].transferring) if d in dwl.sites else 0 stats = self.domains[d] runtime = stats.finished - stats.started if stats.finished else datetime.now() - stats.started - s += '\n' % \ - (d, stats.scraped, stats.crawled, scheduled, pending, active, str(stats.started), str(stats.finished), str(runtime)) + s += '\n' % \ + (d, stats.scraped, stats.crawled, scheduled, dqueued, active, transf, str(stats.started), str(stats.finished), str(runtime)) totdomains += 1 totscraped += stats.scraped totcrawled += stats.crawled totscheduled += scheduled totactive += active - totpending += pending - s += '\n' % \ - (totdomains, totscraped, totcrawled, totscheduled, totactive, totpending) + totdqueued += dqueued + tottransf += transf + s += '\n' % \ + (totdomains, totscraped, totcrawled, totscheduled, totdqueued, totactive, tottransf) s += "
DomainItems
Scraped
Pages
Crawled
Scheduler
Pending
Downloader
Pending
Downloader
Active
Start timeFinish timeRun time
DomainItems
Scraped
Pages
Crawled
Scheduler
Pending
Downloader
Queued
Downloader
Active
Downloader
Transferring
Start timeFinish timeRun time
%s%d%d%d%d%d%s%s%s
%s%d%d%d%d%d%d%s%s%s
%d domains%d%d%d%d%d
%d domains%d%d%d%d%d%d
\n" s += "\n"