diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2017-12-22 17:43:52 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2017-12-22 17:43:52 +0100 |
commit | fd279ff3168c91be2ed8a012af6395034475ccf5 (patch) | |
tree | f4a8b55db5f158a4be4cf8c48aa82d944c206595 /crocoite/cli.py | |
parent | bcfbdd9b45b7e872ee77e1366197443d855d8c7c (diff) | |
download | crocoite-fd279ff3168c91be2ed8a012af6395034475ccf5.tar.gz crocoite-fd279ff3168c91be2ed8a012af6395034475ccf5.tar.bz2 crocoite-fd279ff3168c91be2ed8a012af6395034475ccf5.zip |
Add simple stats-keeping SiteLoader
Diffstat (limited to 'crocoite/cli.py')
-rw-r--r-- | crocoite/cli.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crocoite/cli.py b/crocoite/cli.py index 0880a53..32e0959 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -160,6 +160,8 @@ def archive (self, url, output, onload, onsnapshot, browser, finished_dir = '/tmp/finished' """ + ret = {'stats': None} + self.update_state (state='PROGRESS', meta={'step': 'start'}) stopVarname = '__' + __package__ + '_stop__' @@ -229,11 +231,12 @@ def archive (self, url, output, onload, onsnapshot, browser, if screenshot: self.update_state (state='PROGRESS', meta={'step': 'screenshot'}) writeScreenshot (l.tab, writer) + ret['stats'] = l.stats writer.flush () if not output: outPath = os.path.join (app.conf.finished_dir, outFile) os.rename (fd.name, outPath) - return True + return ret def stateCallback (data): result = data['result'] @@ -271,11 +274,12 @@ def main (): if distributed: result = archive.delay (**passArgs) - result.get (on_message=stateCallback) + r = result.get (on_message=stateCallback) else: # XXX: local evaluation does not init celery logging? logging.basicConfig (level=logging.INFO) - archive (**passArgs) + r = archive (**passArgs) + print (r['stats']) return True |