Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
44 additions
and
48 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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,2 @@ | |||
|
|
||
__version__ = (0, 1, 0, 'dev', 0) | __version__ = (0, 1, 0) |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
from scrapyd.poller import QueuePoller | |||
|
|||
from .utils import get_spider_queues | |||
|
|||
|
|||
class Psycopg2QueuePoller(QueuePoller): | |||
def update_projects(self): | |||
self.queues = get_spider_queues(self.config) |
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,18 +1,11 @@ | |||
import os | from scrapyd.utils import get_project_list | ||
from ConfigParser import NoSectionError | |||
|
|
||
from spiderqueue import Psycopg2SpiderQueue | |||
|
|
||
def get_project_list(config): |
|
||
"""Get list of projects by inspecting the eggs dir and the ones defined in | def get_spider_queues(config): | ||
the scrapyd.conf [settings] section | queues = {} | ||
""" | for project in get_project_list(config): | ||
eggs_dir = config.get('eggs_dir', 'eggs') | table = 'scrapy_%s_queue' % project | ||
if os.path.exists(eggs_dir): | queues[project] = Psycopg2SpiderQueue(config, table=table) | ||
projects = os.listdir(eggs_dir) | return queues | ||
else: | |||
projects = [] | |||
try: | |||
projects += [x[0] for x in config.cp.items('settings')] | |||
except NoSectionError: | |||
pass | |||
return projects |