Пример #1
0
                    HM.CONNECT: connect,
                    HM.DISCONNECT: disconnect,
                    HM.ACK: ack,
                    HM.NACK: nack,
                    HM.MODULE: module,
                    }

        HP.logger.info("Received %d" % msg.message)
        HP.logger.info(handlers)
        handlers[msg.message](s, msg)


def cleanup():
    global s
    global connected
    if connected is True:
        HP.send_hm_message(s, HM(HM.DISCONNECT), False)
        s.shutdown(1)
        s.close()

if __name__ == '__main__':
    HP.start_log('/var/tmp/health-client.log', logging.DEBUG)
    atexit.register(cleanup)
    if len(sys.argv) < 3:
        HP.logger.error("You must provide an hardware file and a host to "
                        "connect as argument")
        sys.exit(1)
    need_exit = False
    while (need_exit is False):
            need_exit = connect_to_server(sys.argv[2])
Пример #2
0
                    (nb_hosts, max_hosts, step_hosts, nb_hosts, cpu_runtime))
                total_runtime += cpu_runtime
                cores = get_default_value(cpu_job, 'cores', 1)
                start_cpu_bench(nb_hosts, cpu_runtime, cores)

                time.sleep(cpu_runtime)

                while (get_host_list(CPU_RUN).keys()):
                    time.sleep(1)

                compute_results(nb_hosts)

    HP.logger.info("End of job %s" % name)
    disconnect_clients()


if __name__ == '__main__':

    HP.start_log('/var/tmp/health-server.log', logging.DEBUG)

    if len(sys.argv) < 2:
        HP.logger.error("You must provide a yaml file as argument")
        sys.exit(1)

    myThread = threading.Thread(target=createAndStartServer)
    myThread.start()

    non_interactive = threading.Thread(target=non_interactive_mode,
                                       args=tuple([sys.argv[1]]))
    non_interactive.start()
Пример #3
0
            do_cpu_job(bench_all, current_job, log_dir, total_runtime)
        if "memory" in current_job['component']:
            do_memory_job(bench_all, current_job, log_dir, total_runtime)
        if "network" in current_job['component']:
            do_network_job(bench_all, current_job, log_dir, total_runtime)
        if "storage" in current_job['component']:
            do_storage_job(bench_all, current_job, log_dir, total_runtime)

    HP.logger.info("End of %s" % name)
    HP.logger.info("Results are available here : %s" % log_dir)
    disconnect_clients()


if __name__ == '__main__':

    HP.start_log('/var/tmp/health-server.log', logging.INFO)
    input_file = ""
    title = ""
    startup_date = time.strftime("%Y_%m_%d-%Hh%M", time.localtime())

    try:
        opts, args = getopt.getopt(sys.argv[1:], "hf:t:", ['file', 'title'])
    except getopt.GetoptError:
        print "Error: One of the options passed to the cmdline was not supported"
        print "Please fix your command line or read the help (-h option)"
        sys.exit(2)

    for opt, arg in opts:
        if opt in ("-h", "--help"):
            print_help()
            sys.exit(0)
Пример #4
0
                                                    cpu_runtime))
                    total_runtime += cpu_runtime
                    cores = get_default_value(cpu_job, 'cores', 1)
                    start_cpu_bench(nb_hosts, cpu_runtime, cores)

                    time.sleep(cpu_runtime)

                    while (get_host_list(CPU_RUN).keys()):
                        time.sleep(1)

                    compute_results(nb_hosts)

    HP.logger.info("End of job %s" % name)
    disconnect_clients()


if __name__ == '__main__':

    HP.start_log('/var/tmp/health-server.log', logging.DEBUG)

    if len(sys.argv) < 2:
        HP.logger.error("You must provide a yaml file as argument")
        sys.exit(1)

    myThread = threading.Thread(target=createAndStartServer)
    myThread.start()

    non_interactive = threading.Thread(target=non_interactive_mode,
                                       args=tuple([sys.argv[1]]))
    non_interactive.start()
Пример #5
0
            HM.DISCONNECT: disconnect,
            HM.ACK: ack,
            HM.NACK: nack,
            HM.MODULE: module,
        }

        HP.logger.info("Received %d" % msg.message)
        HP.logger.info(handlers)
        handlers[msg.message](s, msg)


def cleanup():
    global s
    global connected
    if connected is True:
        HP.send_hm_message(s, HM(HM.DISCONNECT), False)
        s.shutdown(1)
        s.close()


if __name__ == '__main__':
    HP.start_log('/var/tmp/health-client.log', logging.INFO)
    atexit.register(cleanup)
    if len(sys.argv) < 3:
        HP.logger.error("You must provide an hardware file and a host to "
                        "connect as argument")
        sys.exit(1)
    need_exit = False
    while (need_exit is False):
        need_exit = connect_to_server(sys.argv[2])
Пример #6
0
    dump_hosts(log_dir)

    HP.logger.info("Starting %s" % name)
    for next_job in job['jobs']:
        HP.logger.info("Starting job %s" % next_job)
        current_job = job['jobs'][next_job]
        if "cpu" in next_job:
                do_cpu_job(bench_all, current_job, log_dir, total_runtime)
        if "memory" in next_job:
                do_memory_job(bench_all, current_job, log_dir, total_runtime)

    HP.logger.info("End of %s" % name)
    disconnect_clients()


if __name__ == '__main__':

    HP.start_log('/var/tmp/health-server.log', logging.INFO)

    if len(sys.argv) < 2:
        HP.logger.error("You must provide a yaml file as argument")
        sys.exit(1)

    myThread = threading.Thread(target=createAndStartServer)
    myThread.start()

    non_interactive = threading.Thread(target=non_interactive_mode,
                                       args=tuple([sys.argv[1]]))
    non_interactive.start()
Пример #7
0
                    HM.CONNECT: connect,
                    HM.DISCONNECT: disconnect,
                    HM.ACK: ack,
                    HM.NACK: nack,
                    HM.MODULE: module,
                    }

        HP.logger.info("Received %d" % msg.message)
        HP.logger.info(handlers)
        handlers[msg.message](s, msg)


def cleanup():
    global s
    global connected
    if connected is True:
        HP.send_hm_message(s, HM(HM.DISCONNECT), False)
        s.shutdown(1)
        s.close()

if __name__ == '__main__':
    HP.start_log('/var/tmp/health-client.log', logging.INFO)
    atexit.register(cleanup)
    if len(sys.argv) < 3:
        HP.logger.error("You must provide an hardware file and a host to "
                        "connect as argument")
        sys.exit(1)
    need_exit = False
    while (need_exit is False):
            need_exit = connect_to_server(sys.argv[2])
Пример #8
0
            HM.CONNECT: connect,
            HM.DISCONNECT: disconnect,
            HM.ACK: ack,
            HM.NACK: nack,
            HM.MODULE: module,
        }

        HP.logger.info("Received %d" % msg.message)
        HP.logger.info(handlers)
        handlers[msg.message](s, msg)


def cleanup():
    global s
    global connected
    if connected is True:
        HP.send_hm_message(s, HM(HM.DISCONNECT), False)
        s.shutdown(1)
        s.close()


if __name__ == '__main__':
    HP.start_log('/var/tmp/health-client.log', logging.DEBUG)
    atexit.register(cleanup)
    if len(sys.argv) < 3:
        HP.logger.error("You must provide an hardware file and a host to "
                        "connect as argument")
        sys.exit(1)
    hrdw = eval(open(sys.argv[1]).read(-1))
    connect_to_server(hrdw, sys.argv[2])