Esempio n. 1
0
def demo():
    from API import logs
    logs2 = logs.logs_install('123213.log')
    logs2.info(1123)
    #a = bendi_cmd('203',logs=logs2)
    #a.cmd('ls')
    #a.cmd('ls')
    pass
Esempio n. 2
0
def demo(source,target,arguments='-avz --progress --partial --delete'):
    logs2 = logs.logs_install('123213.log')
    data =  rsync(source,target,logs2,exclude_from='',logs_return=True)
    while 1 :
        try:
            print data.next(),
        except Exception as e :
            print e.message
            break
Esempio n. 3
0
def demo():
    BASE_DIR = os.path.abspath('.')
    print BASE_DIR
    zmq_Queue = Queue()
    if not BASE_DIR:
            BASE_DIR = './'
    if BASE_DIR != './':
            BASE_DIR = BASE_DIR + '/'
    logs = logs_install(BASE_DIR + conf.logs_dir + '/apps_2.txt')
    producer_1 = apps_Thread(logs,'消费者模块_1',zmq_Queue)
    producer_1.start()
    producer_2 = apps_Thread(logs,'消费者模块_2',zmq_Queue)
    producer_2.start()
    producer_3 = apps_Thread(logs,'消费者模块_3',zmq_Queue)
    producer_3.start()
    producer = Zmq_Thread(logs,'zmq消息接收模块',zmq_Queue)
    producer.start()
Esempio n. 4
0
    for t in Producer_teds:
        t.join()
def demo(host_list,cmd_list,logs,num=5):
    """
    对外接口
    :param host_list: 主机列表
    [{'host':'127.0.0.1','user':'******','password':'******','port':22}]
    :param cmd_list: 命令列表
    :param logs: logs接口
    :param num: 线程数量
    :return:无返回
    """
    host_list = Ssh_Host(host_list,logs,num=num)

    #初始化队列
    Ssh_cmd(host_list,cmd_list,logs,num=num)


if __name__ == '__main__':
    #标准程序接口方式
    host_list = [{'host':'127.0.0.1',
                  'user':'******',
                  'password':'******',
                  'port':22,
                  'task':2,
                  'Duct_group':3,
                  "host_id":4}]
    cmd_list = ['cd Downloads','ls -l','cat a.py']
    logs2 = logs.logs_install('123213.log')
    logs2.info(123)
    demo(host_list,cmd_list,logs2)
Esempio n. 5
0
def demo(host_list, cmd_list, logs, num=5):
    """
    对外接口
    :param host_list: 主机列表
    [{'host':'127.0.0.1','user':'******','password':'******','port':22}]
    :param cmd_list: 命令列表
    :param logs: logs接口
    :param num: 线程数量
    :return:无返回
    """
    host_list = Ssh_Host(host_list, logs, num=num)

    #初始化队列
    Ssh_cmd(host_list, cmd_list, logs, num=num)


if __name__ == '__main__':
    #标准程序接口方式
    host_list = [{
        'host': '127.0.0.1',
        'user': '******',
        'password': '******',
        'port': 22,
        'task': 2,
        'Duct_group': 3,
        "host_id": 4
    }]
    cmd_list = ['cd Downloads', 'ls -l', 'cat a.py']
    logs2 = logs.logs_install('123213.log')
    logs2.info(123)
    demo(host_list, cmd_list, logs2)