Exemplo n.º 1
0
import os
import yaml
import compago
import zerorpc

from pyutils import *
from pyutils.env_utils import Env

from quant_serviced import serviced
from quant_serviced.server import QuantServiceD

app = compago.Application()
env = Env('QUANT_SERVICED')
serviced_endpoint = env.get('endpoint', 'tcp://0.0.0.0:21200')

@app.command
def server(bind=None):
    e = bind or serviced_endpoint
    config = {
        'endpoint': e
    }
    s = QuantServiceD(config)
    server = zerorpc.Server(s)
    INFO("bind to %s" % e)
    server.bind(e)
    try:
        serviced.run_service('quant_serviced', e, server.run)
    except KeyboardInterrupt:
        INFO("warm shutdown")

@app.command
Exemplo n.º 2
0
import os
from pyutils.env_utils import Env

env = Env('quant_serviced')

QUANT_SERVICED_DEV = env.get('dev')=='1'
QUANT_SERVICED_DEBUG = env.get('debug')=='1'

Exemplo n.º 3
0
import yaml
import compago

import werkzeug.serving
import zerorpc

from pyutils import *
from pyutils.env_utils import Env

from quant_serviced import serviced
from quant_crawler.server import CrawlerServer
from quant_executor.utils import load_job_config_from_packages


app = compago.Application()
env = Env('QUANT_CRAWLER')

crawler_endpoint = env.get('endpoint', 'tcp://0.0.0.0:21130')

@app.command
def server(bind=None):
    e = bind or crawler_endpoint
    conf = {
        'endpoint': e,
    }
    s = CrawlerServer(conf)

    server = zerorpc.Server(s)
    INFO("bind to %s" % e)
    server.bind(e)
    try:
Exemplo n.º 4
0
import os
import yaml
import compago

from pyutils import *
from pyutils.env_utils import Env

from quant_serviced import serviced
from quant_executor import context
from quant_executor.worker import Worker
from quant_executor.utils import load_job_config_from_packages

app = compago.Application()

env = Env('quant_executor')

executor_endpoint = env.get('endpoint', 'tcp://0.0.0.0:21160')

@app.command
def start(job, package=None):
    if package is None:
        w = context.get_worker()
    else:
        config = load_job_config_from_packages(['quant_executor', package])
        w = Worker(config)
    r = w.run_job(job)
    print r

@app.command
def server(bind=None, job_modules=''):
    import zerorpc