Exemplo n.º 1
0
def create_node(elog=None,
                log_file='/dev/stderr',
                log_level=log_level.error,
                cfg=None,
                wait_timeout=3600,
                check_timeout=60,
                flags=0,
                io_thread_num=1,
                net_thread_num=1,
                nonblocking_io_thread_num=1,
                remotes=[]):
    if not elog:
        elog = Logger(log_file, log_level)
    if not cfg:
        cfg = Config()
        cfg.wait_timeout = wait_timeout
        cfg.check_timeout = check_timeout
        cfg.flags = flags
        cfg.io_thread_num = io_thread_num
        cfg.nonblocking_io_thread_num = nonblocking_io_thread_num
        cfg.net_thread_num = net_thread_num
    n = Node(elog, cfg)
    try:
        n.add_remotes(map(Address.from_host_port_family, remotes))
    except Exception as e:
        elog.log(log_level.error,
                 "Coudn't connect to: {0}: {1}".format(repr(remotes), repr(e)))
    return n
Exemplo n.º 2
0
def create_node(elog=None, log_file='/dev/stderr', log_level=log_level.error,
                cfg=None, wait_timeout=3600, check_timeout=60,
                flags=0, io_thread_num=1, net_thread_num=1,
                nonblocking_io_thread_num=1, remotes=[]):
    if not elog:
        elog = Logger(log_file, log_level)
    if not cfg:
        cfg = Config()
        cfg.wait_timeout = wait_timeout
        cfg.check_timeout = check_timeout
        cfg.flags = flags
        cfg.io_thread_num = io_thread_num
        cfg.nonblocking_io_thread_num = nonblocking_io_thread_num
        cfg.net_thread_num = net_thread_num
    n = Node(elog, cfg)
    try:
        n.add_remotes(map(Address.from_host_port_family, remotes))
    except Exception as e:
        elog.log(log_level.error, "Coudn't connect to: {0}: {1}".format(repr(remotes), repr(e)))
    return n
Exemplo n.º 3
0
def create_node(elog=None, log_file='/dev/stderr', log_level=log_level.error,
                cfg=None, wait_timeout=3600, check_timeout=60,
                flags=0, io_thread_num=1, net_thread_num=1,
                nonblocking_io_thread_num=1, remotes=[]):
    if not elog:
        elog = Logger(log_file, log_level)
    if not cfg:
        cfg = Config()
        cfg.wait_timeout = wait_timeout
        cfg.check_timeout = check_timeout
        cfg.flags = flags
        cfg.io_thread_num = io_thread_num
        cfg.nonblocking_io_thread_num = nonblocking_io_thread_num
        cfg.net_thread_num = net_thread_num
    n = Node(elog, cfg)
    try:
        n.add_remotes(map(Address.from_host_port_family, remotes))
    except:
        pass
    return n
Exemplo n.º 4
0
def create_node(elog=None, log_file='/dev/stderr', log_level=log_level.error,
                cfg=None, wait_timeout=3600, check_timeout=60,
                flags=0, io_thread_num=1, net_thread_num=1,
                nonblocking_io_thread_num=1, remotes=[], log_watched=False):
    if not elog:
        elog = Logger(log_file, log_level, log_watched)

    if not cfg:
        cfg = Config()
        cfg.wait_timeout = wait_timeout
        cfg.check_timeout = check_timeout
        cfg.flags = flags
        cfg.io_thread_num = io_thread_num
        cfg.nonblocking_io_thread_num = nonblocking_io_thread_num
        cfg.net_thread_num = net_thread_num

    n = Node(elog, cfg)
    try:
        n.add_remotes(remotes)
    except:
        pass
    return n