Scrapy, a fast high-level web crawling & scraping framework for Python.
moved spider queues to scrapyd
Pablo Hoffman75e2c3eb338e
diff --git a/scrapy/interfaces.py b/scrapy/interfaces.pyindex 43d373359..a5442a40d 100644--- a/scrapy/interfaces.py+++ b/scrapy/interfaces.py@@ -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):diff --git a/scrapy/settings/default_settings.py b/scrapy/settings/default_settings.pyindex 6aec8827f..9eb8eb03b 100644--- a/scrapy/settings/default_settings.py+++ b/scrapy/settings/default_settings.py@@ -237,8 +237,6 @@ SPIDER_MIDDLEWARES_BASE = {SPIDER_MODULES = []-SPIDER_QUEUE_CLASS = 'scrapy.spiderqueue.SqliteSpiderQueue'-SPIDER_CONTEXT_ENABLED = TrueSPIDER_CONTEXT_STORAGE_CLASS = 'scrapy.contrib.spidercontext.SqliteSpiderContextStorage'diff --git a/scrapyd/interfaces.py b/scrapyd/interfaces.pyindex 1e9514269..018da5d08 100644--- a/scrapyd/interfaces.py+++ b/scrapyd/interfaces.py@@ -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"""diff --git a/scrapy/spiderqueue.py b/scrapyd/spiderqueue.pysimilarity index 94%rename from scrapy/spiderqueue.pyrename to scrapyd/spiderqueue.pyindex e19d10fc9..4f3000b84 100644--- a/scrapy/spiderqueue.py+++ b/scrapyd/spiderqueue.py@@ -1,6 +1,6 @@from zope.interface import implements-from scrapy.interfaces import ISpiderQueue+from scrapyd.interfaces import ISpiderQueuefrom scrapy.utils.sqlite import JsonSqlitePriorityQueuefrom scrapy.utils.project import sqlite_dbdiff --git a/scrapy/tests/test_spiderqueue.py b/scrapyd/tests/test_spiderqueue.pysimilarity index 95%rename from scrapy/tests/test_spiderqueue.pyrename to scrapyd/tests/test_spiderqueue.pyindex 574211bae..8a400a0e9 100644--- a/scrapy/tests/test_spiderqueue.py+++ b/scrapyd/tests/test_spiderqueue.py@@ -3,8 +3,8 @@ from twisted.trial import unittestfrom zope.interface.verify import verifyObject-from scrapy.interfaces import ISpiderQueue-from scrapy.spiderqueue import SqliteSpiderQueue+from scrapyd.interfaces import ISpiderQueue+from scrapyd.spiderqueue import SqliteSpiderQueueclass SpiderQueueTest(unittest.TestCase):"""This test case can be used easily for testing other SpiderQueue's bydiff --git a/scrapyd/utils.py b/scrapyd/utils.pyindex c100d9833..e18226072 100644--- a/scrapyd/utils.py+++ b/scrapyd/utils.py@@ -3,7 +3,7 @@ import osfrom subprocess import Popen, PIPEfrom ConfigParser import NoSectionError-from scrapy.spiderqueue import SqliteSpiderQueue+from scrapyd.spiderqueue import SqliteSpiderQueuefrom scrapy.utils.python import stringify_dict, unicode_to_strfrom scrapyd.config import Config