我有几只蜘蛛要爬。我使用默认设置的scrapyd。我设法用scrapyd接口来安排我的工作。目前一切都很好,只是工作没有结束。每次我检查时,我都会发现16个(4个作业/4个CPU)作业正在运行,所有其他作业都处于挂起状态,除非我关闭scrapy。在
我还检查了日志,上面写着:
2013-09-22 12:20:55+0000 [spider1] INFO: Dumping Scrapy stats:
{
'downloader/exception_count': 1,
'downloader/exception_type_count/scrapy.exceptions.IgnoreRequest': 1,
'downloader/request_bytes': 244,
'downloader/request_count': 1,
'downloader/request_method_count/GET': 1,
'downloader/response_bytes': 7886,
'downloader/response_count': 1,
'downloader/response_status_count/200': 1,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2013, 9, 22, 12, 20, 55, 635611),
'log_count/DEBUG': 7,
'log_count/INFO': 3,
'request_depth_max': 1,
'response_received_count': 1,
'scheduler/dequeued': 2,
'scheduler/dequeued/memory': 2,
'scheduler/enqueued': 2,
'scheduler/enqueued/memory': 2,
'start_time': datetime.datetime(2013, 9, 22, 12, 20, 55, 270275)}
2013-09-22 12:20:55+0000 [spider1] INFO: Spider closed (finished)
你怎么用scrapyd刮几百只蜘蛛?在
编辑:
在碎屑.cfg公司名称:
^{pr2}$发痒的设置.py在
import os
from django.conf import settings
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myproject.settings")
BOT_NAME = 'scrapers'
SPIDER_MODULES = ['myproject.scrapers.spiders']
DOWNLOADER_MIDDLEWARES = {
'myproject.scrapers.middlewares.IgnoreDownloaderMiddleware': 50,
}
ITEM_PIPELINES = [
'myproject.scrapers.pipelines.CheckPipeline',
'myproject.scrapers.pipelines.CleanPipeline',
'myproject.contrib.pipeline.images.ImagesPipeline',
'myproject.scrapers.pipelines.SerializePipeline',
'myproject.scrapers.pipelines.StatsCollectionPipeline',
]
DOWNLOAD_DELAY = 0.25
path_to_phatomjs = '/home/user/workspace/phantomjs-1.9.1-linux-x86_64/bin/phantomjs'
IMAGES_STORE = settings.MEDIA_ROOT + '/' + settings.IMAGES_STORE
IMAGES_THUMBS = {
'small': (70, 70),
'big': (270, 270),
}
我昨天刚找到问题的根源,就想把这个答案贴出来,但我的账户出了点问题。在
问题来自于PhantomJs驱动程序,它阻止了scrapyd完成工作。在
一开始我用删除功能退出驱动程序:
现在,我创建了一个函数quit_驱动程序,并将其连接到spider_closed signal上。在
^{pr2}$相关问题 更多 >
编程相关推荐