Exemplo n.º 1
0
services_dir = abspath(pathjoin('..', 'services'))
libraries_dir = abspath(pathjoin('..', 'libraries'))

with open(pathjoin(services_dir, 'services.json'), 'r') as config_file:
    config = load(config_file)
docstore_host = str(config['docstore_host'])
docstore_port = str(config['docstore_port'])
docstore_url = 'http://%s:%s' % (docstore_host, docstore_port)
pubsub_url = str(config['pubsub_url'])
pubsub = pubsub_connect(pubsub_url, 'process', marshal=dumps)

docstore_dir = abspath(pathjoin(services_dir, 'docstore_server_http'))
install_dir('docstore_server_http', [docstore_dir, libraries_dir],
            [docstore_host, docstore_port], docstore_url, 'services')

docstore = docstore_connect(docstore_url)
if docstore.wait_until_up() is False:
    print 'Could not start docstore'
    exit(1)

publisher_dir = abspath(pathjoin(services_dir, 'publisher'))
install_dir('publisher', [publisher_dir, libraries_dir], [docstore_url],
            docstore_url, 'services')
sleep(1)

pubsub_alex = pubsub_connect(pubsub_url, 'alexandra')
root = abspath('..')
num_files_published = publish_dir(root, root, pubsub_alex)
files = []
while len(files) < num_files_published:
    files = loads(docstore_connect(docstore_url).get('/alexandra/index.json'))
Exemplo n.º 2
0
#! /usr/bin/env python

from docstore import connect as docstore_connect
from os import getenv
from pubsub import firehose
from sys import argv

def publish(context, topic, message, docstore):
    docstore.put(message, '/%s/%s' % (context, topic))

docstore_url = argv[1]
docstore = docstore_connect(docstore_url)
pubsub_url = getenv('ALEXANDRA_PUBSUB')
pubsub = firehose(pubsub_url)
pubsub.consume_all(lambda c,t,m: publish(c, t, m, docstore))
Exemplo n.º 3
0
services_dir = abspath(pathjoin('..', 'services'))
libraries_dir = abspath(pathjoin('..', 'libraries'))

with open(pathjoin(services_dir, 'services.json'), 'r') as config_file:
    config = load(config_file)
docstore_host = str(config['docstore_host'])
docstore_port = str(config['docstore_port'])
docstore_url = 'http://%s:%s' % (docstore_host, docstore_port)
pubsub_url = str(config['pubsub_url'])
pubsub = pubsub_connect(pubsub_url, 'process', marshal=dumps)

docstore_dir = abspath(pathjoin(services_dir, 'docstore_server_http'))
install_dir('docstore_server_http', [docstore_dir, libraries_dir],
            [docstore_host, docstore_port], docstore_url, 'services')

docstore = docstore_connect(docstore_url)
if docstore.wait_until_up() is False:
    print 'Could not start docstore'
    exit(1)

publisher_dir = abspath(pathjoin(services_dir, 'publisher'))
install_dir('publisher', [publisher_dir, libraries_dir],
            [docstore_url], docstore_url, 'services')
sleep(1)    

pubsub_alex = pubsub_connect(pubsub_url, 'alexandra')
root = abspath('..')
num_files_published = publish_dir(root, root, pubsub_alex)
files = []
while len(files) < num_files_published:
    files = loads(docstore_connect(docstore_url).get('/alexandra/index.json'))
Exemplo n.º 4
0
 def _init_docstore(self):
     location_queue = self._subscribe_raw('docstore', 'location')
     self._publish_raw('docstore', 'locate', 'locate')
     docstore_url = self._get_message_block_raw(location_queue, timeout=1)
     self._docstore = docstore_connect(docstore_url)
Exemplo n.º 5
0
 def _init_docstore(self):
     location_queue = self._subscribe_raw('docstore', 'location')
     self._publish_raw('docstore', 'locate', 'locate')
     docstore_url = self._get_message_block_raw(location_queue, timeout=1)
     self._docstore = docstore_connect(docstore_url)