Skip to content

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.py
index 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.py
index 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 = True
SPIDER_CONTEXT_STORAGE_CLASS = 'scrapy.contrib.spidercontext.SqliteSpiderContextStorage'
diff --git a/scrapyd/interfaces.py b/scrapyd/interfaces.py
index 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.py
similarity index 94%
rename from scrapy/spiderqueue.py
rename to scrapyd/spiderqueue.py
index 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 ISpiderQueue
from scrapy.utils.sqlite import JsonSqlitePriorityQueue
from scrapy.utils.project import sqlite_db
diff --git a/scrapy/tests/test_spiderqueue.py b/scrapyd/tests/test_spiderqueue.py
similarity index 95%
rename from scrapy/tests/test_spiderqueue.py
rename to scrapyd/tests/test_spiderqueue.py
index 574211bae..8a400a0e9 100644
--- a/scrapy/tests/test_spiderqueue.py
+++ b/scrapyd/tests/test_spiderqueue.py
@@ -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
diff --git a/scrapyd/utils.py b/scrapyd/utils.py
index c100d9833..e18226072 100644
--- a/scrapyd/utils.py
+++ b/scrapyd/utils.py
@@ -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