コード例 #1
0
ファイル: spider.py プロジェクト: reuf/ifcb-analysis
def spider(worker, job):
    "Gearman entry point"
    url = job.data
    client = GearmanClient(['localhost'])
    for href in url2hrefs(url): # for URL the content of that URL refers to,
        (blah,ext) = path.splitext(href)
        if ext != '.json':
            href = href + '.json'
        # submit a new spider job for that href
        client.submit_job('spider',href,background=True,wait_until_complete=False)
    return job.data
コード例 #2
0
ファイル: client.py プロジェクト: reuf/ifcb-analysis
#!/usr/bin/python

from gearman.client import GearmanClient

client = GearmanClient(['localhost'])

URL = 'http://ifcb-data.whoi.edu/feed.json'

client.submit_job('spider', URL)

コード例 #3
0
 def __init__(self, config):
     self.config = config
     self.client = GearmanClient(
         self.config.get('gearman', 'hosts').split(','))