コード例 #1
0
ファイル: mzbench_api_client.py プロジェクト: vernemq/mzbench
def run_command(host,
                bench_id,
                pool,
                percent,
                bdl_command,
                no_cert_check=False):
    """Executes worker operation on a given percent of a pool on the fly

    :param host: MZBench API server host with port
    :type host: str
    :param bench_id: benchmark run id
    :type bench_id: int
    :param pool: pool number from the top of the script, starting from 1
    :type pool: int
    :param percent: percent of workers 0 < percent <= 100
    :type percent: int
    :param command: BDL statement to be executed
    :type command: string
    :param no_cert_check: Don't check server HTTPS certificate
    :type no_cert_check: boolean
    """
    import bdl_utils
    bdl_utils.convert("#!benchDL\n" + bdl_command, {})  # To check syntax

    return assert_successful_get(host,
                                 '/run_command', {
                                     'id': bench_id,
                                     'pool': pool,
                                     'percent': percent,
                                     'command': bdl_command
                                 },
                                 no_cert_check=no_cert_check)
コード例 #2
0
def run_command(host, bench_id, pool, percent, bdl_command, no_cert_check = False):
    """Executes worker operation on a given percent of a pool on the fly

    :param host: MZBench API server host with port
    :type host: str
    :param bench_id: benchmark run id
    :type bench_id: int
    :param pool: pool number from the top of the script, starting from 1
    :type pool: int
    :param percent: percent of workers 0 < percent <= 100
    :type percent: int
    :param command: BDL statement to be executed
    :type command: string
    :param no_cert_check: Don't check server HTTPS certificate
    :type no_cert_check: boolean
    """
    import bdl_utils
    bdl_utils.convert("#!benchDL\n" + bdl_command, {}) # To check syntax

    return assert_successful_get(
        host,
        '/run_command',
        {'id': bench_id,
         'pool': pool,
         'percent': percent,
         'command': bdl_command}, no_cert_check = no_cert_check)
コード例 #3
0
ファイル: bdl_utils_test.py プロジェクト: waliferus/mzbench
def test_includes_3():
    eq_(bdl_utils.get_includes(bdl_utils.convert("""#!benchDL
# second comment
include_resource(test_json, "file.json", json)
pool(size = 17,
    worker_type = dummy_worker):
 do_stuff(1,2)""", {})), [["test_json", "file.json"]])
コード例 #4
0
ファイル: bdl_utils_test.py プロジェクト: waliferus/mzbench
def test_num_of_workers_3():
    eq_(bdl_utils.get_num_of_workers(bdl_utils.convert("""#!benchDL
pool(size = 17K,
    worker_type = dummy_worker):
 do_stuff(1,2)

pool(size = 13M,
    worker_type = dummy_worker):
 do_stuff(1,2)""", {})), 13017000)
コード例 #5
0
ファイル: bdl_utils_test.py プロジェクト: waliferus/mzbench
def test_num_of_workers_2():
    eq_(bdl_utils.get_num_of_workers(bdl_utils.convert("""#!benchDL
pool(size = var("num2", 3),
    worker_type = dummy_worker):
 do_stuff(1,2)

pool(size = var("num", 3),
    worker_type = dummy_worker):
 do_stuff(1,2)""", {"num": 7})), 10)
コード例 #6
0
ファイル: bdl_utils_test.py プロジェクト: waliferus/mzbench
def test_includes_2():
    eq_(bdl_utils.get_includes(bdl_utils.convert("""#!benchDL
include_resourse()
pool(size = 17,
    worker_type = dummy_worker):
 do_stuff(1,2)""", {})), [])