mirror of https://github.com/scrapy/scrapy.git
moved spider queues to scrapyd
--HG-- rename : scrapy/spiderqueue.py => scrapyd/spiderqueue.py rename : scrapy/tests/test_spiderqueue.py => scrapyd/tests/test_spiderqueue.py
This commit is contained in:
parent
d97d6d20c6
commit
75e2c3eb33
|
|
@ -1,39 +1,5 @@
|
|||
from zope.interface import Interface
|
||||
|
||||
class ISpiderQueue(Interface):
|
||||
|
||||
def from_settings(settings):
|
||||
"""Class method to instantiate from settings"""
|
||||
|
||||
def add(name, **spider_args):
|
||||
"""Add a spider to the queue given its name a some spider arguments.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def pop():
|
||||
"""Pop the next mesasge from the queue. The messages is a dict
|
||||
conaining a key 'name' with the spider name and other keys as spider
|
||||
attributes.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def list():
|
||||
"""Return a list with the messages in the queue. Each message is a dict
|
||||
which must have a 'name' key (with the spider name), and other optional
|
||||
keys that will be used as spider arguments, to create the spider.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def count():
|
||||
"""Return the number of spiders in the queue.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def clear():
|
||||
"""Clear the queue.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
class ISpiderManager(Interface):
|
||||
|
||||
def from_settings(settings):
|
||||
|
|
|
|||
|
|
@ -237,8 +237,6 @@ SPIDER_MIDDLEWARES_BASE = {
|
|||
|
||||
SPIDER_MODULES = []
|
||||
|
||||
SPIDER_QUEUE_CLASS = 'scrapy.spiderqueue.SqliteSpiderQueue'
|
||||
|
||||
SPIDER_CONTEXT_ENABLED = True
|
||||
SPIDER_CONTEXT_STORAGE_CLASS = 'scrapy.contrib.spidercontext.SqliteSpiderContextStorage'
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,41 @@ class IPoller(Interface):
|
|||
projects"""
|
||||
|
||||
|
||||
class ISpiderQueue(Interface):
|
||||
|
||||
def from_settings(settings):
|
||||
"""Class method to instantiate from settings"""
|
||||
|
||||
def add(name, **spider_args):
|
||||
"""Add a spider to the queue given its name a some spider arguments.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def pop():
|
||||
"""Pop the next mesasge from the queue. The messages is a dict
|
||||
conaining a key 'name' with the spider name and other keys as spider
|
||||
attributes.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def list():
|
||||
"""Return a list with the messages in the queue. Each message is a dict
|
||||
which must have a 'name' key (with the spider name), and other optional
|
||||
keys that will be used as spider arguments, to create the spider.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def count():
|
||||
"""Return the number of spiders in the queue.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
def clear():
|
||||
"""Clear the queue.
|
||||
|
||||
This method can return a deferred. """
|
||||
|
||||
|
||||
class ISpiderScheduler(Interface):
|
||||
"""A component to schedule spider runs"""
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from zope.interface import implements
|
||||
|
||||
from scrapy.interfaces import ISpiderQueue
|
||||
from scrapyd.interfaces import ISpiderQueue
|
||||
from scrapy.utils.sqlite import JsonSqlitePriorityQueue
|
||||
from scrapy.utils.project import sqlite_db
|
||||
|
||||
|
|
@ -3,8 +3,8 @@ from twisted.trial import unittest
|
|||
|
||||
from zope.interface.verify import verifyObject
|
||||
|
||||
from scrapy.interfaces import ISpiderQueue
|
||||
from scrapy.spiderqueue import SqliteSpiderQueue
|
||||
from scrapyd.interfaces import ISpiderQueue
|
||||
from scrapyd.spiderqueue import SqliteSpiderQueue
|
||||
|
||||
class SpiderQueueTest(unittest.TestCase):
|
||||
"""This test case can be used easily for testing other SpiderQueue's by
|
||||
|
|
@ -3,7 +3,7 @@ import os
|
|||
from subprocess import Popen, PIPE
|
||||
from ConfigParser import NoSectionError
|
||||
|
||||
from scrapy.spiderqueue import SqliteSpiderQueue
|
||||
from scrapyd.spiderqueue import SqliteSpiderQueue
|
||||
from scrapy.utils.python import stringify_dict, unicode_to_str
|
||||
from scrapyd.config import Config
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue