Пример #1
0
def services():
    etcd = context.get_etcd()
    for k,v in etcd.find_services().items():
        print '[%s]' % k
        for a in v:
            print '    %s %s' % (a[0], a[1])
    print '-'*10
Пример #2
0
import yaml

from pyutils import *
from pyutils.env_utils import Env
from pyutils.create_obj import create_obj_from_config

from quant_etcd import context as etcd_context
from quant_executor.worker import Worker

env = Env('quant_executor')

_worker = None
_state_saver = None

etcd = etcd_context.get_etcd()

def get_worker():
    global _worker
    if _worker is None:
        config = etcd.as_dict('quant_executor')
        DEBUG("[create worker]")
        DEBUG("\n"+yaml.safe_dump(config))
        _worker = Worker(config)
    return _worker

def get_state_saver():
    global _state_saver
    if _state_saver is None:
        d = etcd['quant_executor/executor/state_saver']
        if d is None:
            return None
Пример #3
0
def remove_service(service):
    etcd = context.get_etcd()
    etcd.remove_service(service)