예제 #1
0
def load_config(file_name):
    file_name = os.path.abspath(file_name)

    defaults = dict(
        sensors_remote_path='/tmp/sensors',
        testnode_log_root='/tmp/wally',
        settings={}
    )

    raw_cfg = yaml.load(open(file_name).read())
    raw_cfg['config_folder'] = os.path.dirname(file_name)
    if 'include' in raw_cfg:
        default_path = os.path.join(raw_cfg['config_folder'],
                                    raw_cfg.pop('include'))
        default_cfg = yaml.load(open(default_path).read())

        # TODO: Need more intelectual configs merge?
        default_cfg.update(raw_cfg)
        raw_cfg = default_cfg

    cfg = Config(defaults)
    cfg.update(raw_cfg)

    results_storage = cfg.settings.get('results_storage', '/tmp')
    results_storage = os.path.abspath(results_storage)

    existing = file_name.startswith(results_storage)

    if existing:
        cfg.results_dir = os.path.dirname(file_name)
        cfg.run_uuid = os.path.basename(cfg.results_dir)
    else:
        # genarate result folder name
        for i in range(10):
            cfg.run_uuid = pet_generate(2, "_")
            cfg.results_dir = os.path.join(results_storage,
                                           cfg.run_uuid)
            if not os.path.exists(cfg.results_dir):
                break
        else:
            cfg.run_uuid = str(uuid.uuid4())
            cfg.results_dir = os.path.join(results_storage,
                                           cfg.run_uuid)

    # setup all files paths
    cfg.update(get_test_files(cfg.results_dir))

    if existing:
        cfg.update(load_run_params(cfg.run_params_file))

    testnode_log_root = cfg.get('testnode_log_root')
    testnode_log_dir = os.path.join(testnode_log_root, "{0}/{{name}}")
    cfg.default_test_local_folder = testnode_log_dir.format(cfg.run_uuid)

    return cfg
예제 #2
0
def get_uniq_path_uuid(path: str, max_iter: int = 10) -> Tuple[str, str]:
    for i in range(max_iter):
        run_uuid = pet_generate(2, "_")
        results_dir = os.path.join(path, run_uuid)
        if not os.path.exists(results_dir):
            break
    else:
        run_uuid = str(uuid.uuid4())
        results_dir = os.path.join(path, run_uuid)

    return results_dir, run_uuid
예제 #3
0
def load_config(file_name):
    file_name = os.path.abspath(file_name)

    defaults = dict(sensors_remote_path='/tmp/sensors',
                    testnode_log_root='/tmp/wally',
                    settings={})

    raw_cfg = yaml.load(open(file_name).read())
    raw_cfg['config_folder'] = os.path.dirname(file_name)
    if 'include' in raw_cfg:
        default_path = os.path.join(raw_cfg['config_folder'],
                                    raw_cfg.pop('include'))
        default_cfg = yaml.load(open(default_path).read())

        # TODO: Need more intelectual configs merge?
        default_cfg.update(raw_cfg)
        raw_cfg = default_cfg

    cfg = Config(defaults)
    cfg.update(raw_cfg)

    results_storage = cfg.settings.get('results_storage', '/tmp')
    results_storage = os.path.abspath(results_storage)

    existing = file_name.startswith(results_storage)

    if existing:
        cfg.results_dir = os.path.dirname(file_name)
        cfg.run_uuid = os.path.basename(cfg.results_dir)
    else:
        # genarate result folder name
        for i in range(10):
            cfg.run_uuid = pet_generate(2, "_")
            cfg.results_dir = os.path.join(results_storage, cfg.run_uuid)
            if not os.path.exists(cfg.results_dir):
                break
        else:
            cfg.run_uuid = str(uuid.uuid4())
            cfg.results_dir = os.path.join(results_storage, cfg.run_uuid)

    # setup all files paths
    cfg.update(get_test_files(cfg.results_dir))

    if existing:
        cfg.update(load_run_params(cfg.run_params_file))

    testnode_log_root = cfg.get('testnode_log_root')
    testnode_log_dir = os.path.join(testnode_log_root, "{0}/{{name}}")
    cfg.default_test_local_folder = testnode_log_dir.format(cfg.run_uuid)

    return cfg
import os
import sys
import uuid
import random
import itertools

from petname import Generate as pet_generate
from storage_api import create_storage

from report import ssize_to_kb

types = ["GA", "master"] + [pet_generate(2, '-') for _ in range(2)]
random.shuffle(types)
tp = itertools.cycle(types)

sz = ["1k", "4k", "64k", "256k", "1m"]
op_type = ["randread", "read", "randwrite", "write"]
is_sync = ["s", "a"]

storage = create_storage(sys.argv[1], "", "")
combinations = list(itertools.product(op_type, is_sync, sz))

for i in range(30):
    row = {"build_id": pet_generate(2, " "),
           "type": next(tp),
           "iso_md5": uuid.uuid4().get_hex()}

    for op_type, is_sync, sz in combinations:
        ((random.random() - 0.5) * 0.2 + 1)
        row[" ".join([op_type, is_sync, sz])] = (
            ((random.random() - 0.5) * 0.2 + 1) * (ssize_to_kb(sz) ** 0.5),
import os
import sys
import uuid
import random
import itertools

from petname import Generate as pet_generate
from storage_api import create_storage

from report import ssize_to_kb

types = ["GA", "master"] + [pet_generate(2, '-') for _ in range(2)]
random.shuffle(types)
tp = itertools.cycle(types)

sz = ["1k", "4k", "64k", "256k", "1m"]
op_type = ["randread", "read", "randwrite", "write"]
is_sync = ["s", "a"]

storage = create_storage(sys.argv[1], "", "")
combinations = list(itertools.product(op_type, is_sync, sz))

for i in range(30):
    row = {
        "build_id": pet_generate(2, " "),
        "type": next(tp),
        "iso_md5": uuid.uuid4().get_hex()
    }

    for op_type, is_sync, sz in combinations:
        ((random.random() - 0.5) * 0.2 + 1)