def collect_results_cmd(args):
    with BenchmarkingController(args.config) as bc:
        logs = bc.collect_execution_results(args.id)
        for i in logs:
            print('***** VM: {0} *****'.format(i['vm']))
            print('stdout:\n{0}'.format(str(i['stdout'])))
            print('\nstderr:\n{0}\n\n'.format(str(i['stderr'])))
def list_providers_cmd(args):
    table = PrettyTable()
    table.field_names = ["Name", "Service Types"]
    table.align = 'l'
    with BenchmarkingController(args.config) as bc:
        for p in bc.list_available_providers():
            table.add_row([p.name, ', '.join(p.service_types)])
    print(table.get_string())
def list_benchmarks_cmd(args):
    table = PrettyTable()
    table.field_names = ["Tool", "Workloads"]
    table.align = 'l'
    with BenchmarkingController(args.config) as bc:
        for p in bc.list_available_benchmark_cfgs():
            table.add_row([p.tool_name, [n['id'] for n in p.workloads]])
    print(table.get_string())
def list_executions_cmd(args):

    table = PrettyTable()
    table.field_names = ["Id", "Benchmark", "Created", "Exec. Env.", "Session"]

    with BenchmarkingController(args.config) as bc:
        execs = bc.list_executions()
        for e in execs:
            created = datetime.fromtimestamp(
                e.created).strftime('%Y-%m-%d %H:%M:%S')
            table.add_row([
                e.id,
                str(e.test.tool_name) + '/' + str(e.test.workload_name),
                created,
                str(e.exec_env), e.session.id
            ])

    print(table.get_string())
def list_sessions_cmd(args):

    table = PrettyTable()
    table.field_names = [
        "Id", "Provider", "Service Type", "Created", "Properties"
    ]

    with BenchmarkingController(args.config) as bc:
        sessions = bc.list_sessions()
        for s in sessions:
            created = datetime.fromtimestamp(
                s.created).strftime('%Y-%m-%d %H:%M:%S')
            props = "; ".join(
                ["{0}={1}".format(k, v)
                 for k, v in s.props.items()]) if hasattr(s, 'props') else ""
            table.add_row([
                s.id, s.provider.name, s.provider.service_type, created, props
            ])

        print(table.get_string())
def multiexec_cmd(args):

    # parse the tests to execute
    tuples = []
    for s in args.tests:
        t = s.split(':', maxsplit=1)
        if len(t) == 1:
            tuples.append((t[0], None))
        else:
            tuples.append((t[0], t[1]))

    with BenchmarkingController(storage_config_file=args.storage_config) as bc:
        bc.execute_onestep(
            args.provider,
            args.service_type,
            tuples,
            new_session_props=parse_new_session_properties(args),
            fail_on_error=args.failonerror,
            destroy_session=not args.keep_env,
            max_retry=args.max_retry or 1)
def completer_most_recent_exec(prefix, parsed_args, **kwargs):
    bc = BenchmarkingController()
    execs = bc.list_executions()
    execs.sort(key=lambda x: x.created, reverse=True)
    return [execs[0].id]
def run_execution_cmd(args):
    with BenchmarkingController(args.config,
                                storage_config_file=args.storage_config) as bc:
        bc.run_execution(args.id, _async=args._async)
def cleanup_execution_cmd(args):
    with BenchmarkingController(args.config) as bc:
        bc.cleanup_execution(args.id)
Esempio n. 10
0
def prepare_execution_cmd(args):
    with BenchmarkingController(args.config) as bc:
        bc.prepare_execution(args.id)
Esempio n. 11
0
def new_execution_cmd(args):
    with BenchmarkingController(args.config) as bc:
        e = bc.new_execution(args.session, args.tool, args.workload)
        print(e.id)
Esempio n. 12
0
def new_session_cmd(args):
    with BenchmarkingController(args.config) as bc:
        e = bc.new_session(args.provider,
                           args.service_type,
                           properties=parse_new_session_properties(args))
        print(e.id)
Esempio n. 13
0
def destroy_session_cmd(args):
    with BenchmarkingController(args.config) as bc:
        bc.destroy_session(args.id)
        print('Session {0} successfully destroyed'.format(args.id))