Esempio n. 1
0
def cmd_crawl(args, options):
    if len(args) != 1:
        logging.error("Missing build URL")
        return 1
    if options.to_file and not os.path.exists(options.to_file):
        os.mkdir(options.to_file)
    if options.from_file and not os.path.exists(options.from_file):
        os.mkdir(options.from_file)
    db = open_db(options)
    crawl = Crawl(db, options)
    if options.reverse:
        roots = crawl.reverse_crawl(args[0])
    else:
        roots = crawl.crawl(args[0])
    close_db(db)
    stat = roots[0].extra
    logging.info("Started: %s\n\tend: %s\n\telapsed: %s\n\tduration: %ss\n\tNb builds: %s\n\ttrhoughput: %s\n" % (
            stat['start'], stat['stop'], stat['elapsed'], stat['duration'], stat['count'], stat['throughput']))
    if not options.output:
        svg_file = roots[0].getId() + ".svg"
    else:
        svg_file = options.output
    graphviz(roots, svg_file)
    logging.info("%s generated." % svg_file)
    return 0
Esempio n. 2
0
def cmd_info(args, options):
    if len(args) != 1:
        logging.error('Missing bid')
        return 1
    db = open_db(options)
    # bencher = Bencher.getBencherForBid(db, options, args[0])
    # print """bid: %(bid)s, from %(start)s to %(end)s, samples: %(count)d, errors: %(error)d""" % bencher.getInfo(args[0])
    close_db(db)
    return 0
Esempio n. 3
0
def cmd_info(args, options):
    if len(args) != 1:
        logging.error('Missing bid')
        return 1
    db = open_db(options)
    bencher = Bencher.getBencherForBid(db, options, args[0])
    print """bid: %(bid)s, from %(start)s to %(end)s, samples: %(count)d, errors: %(error)d""" % bencher.getInfo(args[0])
    db.close()
    return 0
Esempio n. 4
0
def cmd_report(args, options):
    if len(args) != 1:
        logging.error('Missing bid')
        return 1
    if not options.output:
        logging.error('Missing --output option')
        return 1
    db = open_db(options)
    # report = Report(db, options)
    # report.buildReport(args[0])
    close_db(db)
    return 0
Esempio n. 5
0
def cmd_addsar(args, options):
    if len(args) != 2:
        logging.error('Expected arguments: BID FILE')
        return 1
    if not options.host:
        logging.error('Missing --host option')
        return 1
    db = open_db(options)
    sar = Sar(db, options)
    sar.doImport(args[0], args[1])
    db.close()
    return 0
Esempio n. 6
0
def cmd_report(args, options):
    if len(args) != 1:
        logging.error('Missing bid')
        return 1
    if not options.output:
        logging.error('Missing --output option')
        return 1
    db = open_db(options)
    report = Report(db, options)
    report.buildReport(args[0])
    db.close()
    return 0
Esempio n. 7
0
def cmd_import(args, options):
    if len(args) != 1:
        logging.error("Missing import file")
        return 1
    db = open_db(options)
    if options.funkload:
        bencher = FunkLoad(db, options)
    elif options.jmeter:
        bencher = JMeter(db, options)
    else:
        logging.error('Unknown import type')
        return 1
    bid = bencher.doImport(args[0])
    db.close()
    if bid:
        logging.info("File imported, bench identifier (bid): %d" % bid)
    else:
        return 1
    return 0
Esempio n. 8
0
def cmd_list(args, options):
    db = open_db(options)
    list_builds(db)
    close_db(db)
    return 0
Esempio n. 9
0
def cmd_list(args, options):
    db = open_db(options)
    list_benchmarks(db)
    db.close()
    return 0