forked from binux/pyspider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use local projectdb in bench test, try to fix python 3.3 test hang issue
- Loading branch information
Showing
3 changed files
with
16 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
# Author: Binux<[email protected]> | ||
# http://binux.me | ||
# Created on 2014-12-08 22:23:10 | ||
# rate: 10000000000 | ||
# burst: 10000000000 | ||
|
||
import time | ||
import logging | ||
|
@@ -248,17 +250,16 @@ def on_result(self, task, result): | |
super(BenchResultWorker, self).on_result(task, result) | ||
|
||
|
||
bench_script = ''' | ||
from pyspider.libs.base_handler import * | ||
from pyspider.libs.base_handler import BaseHandler | ||
|
||
|
||
class Handler(BaseHandler): | ||
def on_start(self): | ||
def on_start(self, response): | ||
self.crawl('http://127.0.0.1:5000/bench', | ||
params={'total': %(total)d, 'show': %(show)d}, | ||
params={'total': response.save.get('total', 10000), 'show': response.save.get('show', 20)}, | ||
callback=self.index_page) | ||
|
||
def index_page(self, response): | ||
for each in response.doc('a[href^="http://"]').items(): | ||
self.crawl(each.attr.href, callback=self.index_page) | ||
return response.url | ||
''' |
This file contains 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
This file contains 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