Exemple #1
0
def deploy(broker, provider, force, env):
    providers = {"g5k": t.g5k, "vagrant": t.vagrant}
    p = providers[provider]

    p(broker=broker, force=force, env=env)
    t.inventory()
    t.prepare(broker=broker)
Exemple #2
0
def deploy(broker, provider, force, conf, env):
    config = {}
    with open(conf) as f:
        config = yaml.load(f)
    p = PROVIDERS[provider]

    p(broker=broker, force=force, config=config, env=env)
    t.inventory()
    t.prepare(broker=broker)
Exemple #3
0
    sweeps = sweep(PARAMETERS)
    sweeper = ParamSweeper(
        # Maybe puts the sweeper under the experimentation directory
        # This should be current/sweeps
        persistence_dir=os.path.join("%s/sweeps" % TEST_DIR),
        sweeps=sweeps,
        save_sweeps=True,
        name="test_case_1")

    #Get the next parameter in the set of all remaining params
    #This set is temporary viewed as sorted List with this filter function.
    params = sweeper.get_next(sort_params_by_nbr_clients)
    while params:
        if not accept(params):
            # skipping element
            # Note that the semantic of sweeper.skip is different
            sweeper.done(params)
            params = sweeper.get_next(sort_params_by_nbr_clients)
            continue
        # cleaning old backup_dir
        params.pop("backup_dir", None)
        params.update({"backup_dir": generate_id(params)})
        t.g5k(broker=BROKER, env=TEST_DIR)
        t.inventory()
        t.prepare(broker=BROKER)
        print(params)
        t.test_case_1(**params)
        sweeper.done(params)
        params = sweeper.get_next(sort_params_by_nbr_clients)
        t.destroy()
Exemple #4
0
def inventory():
    t.inventory()
Exemple #5
0
def campaign(broker, provider, conf, test, env):
    def generate_id(params):
        def clean(s):
            return str(s).replace("/", "_sl_") \
                .replace(":", "_sc_")

        return "-".join([
            "%s__%s" % (clean(k), clean(v)) for k, v in sorted(params.items())
        ])

    def accept(params):
        call_ratio_max = 3
        cast_ratio_max = 3
        call_type = params["call_type"]
        if params["nbr_servers"] > params["nbr_clients"]:
            return False
        if call_type == "rpc-call":
            if not params["pause"]:
                # maximum rate
                return call_ratio_max * params["nbr_servers"] >= params[
                    "nbr_clients"]
            else:
                # we can afford more clients
                # based on our estimation a client sends 200msgs at full rate
                return call_ratio_max * params["nbr_servers"] >= params[
                    "nbr_clients"] * 200 * params["pause"]
        else:
            if not params["pause"]:
                # maximum rate
                return cast_ratio_max * params["nbr_servers"] >= params[
                    "nbr_clients"]
            else:
                # we can afford more clients
                # based on our estimation a client sends 200msgs at full rate
                return cast_ratio_max * params["nbr_servers"] >= params[
                    "nbr_clients"] * 1000 * params["pause"]

    # Function to pass in parameter to ParamSweeper.get_next()
    # Give the illusion that the Set of params is sorted by nbr_clients
    def sort_params_by_nbr_clients(set):
        return sorted((list(set)), key=lambda k: k['nbr_clients'])

    # Dump each params in the backup dir
    def dump_param(params):
        if not os.path.exists("%s/params.json" % test):
            with open("%s/params.json" % test, 'w') as outfile:
                json.dump([], outfile)
        #Add the current params to the json
        with open("%s/params.json" % test, 'r') as outfile:
            all_params = json.load(outfile)
        all_params.append(params)
        with open("%s/params.json" % test, 'w') as outfile:
            json.dump(all_params, outfile)

    # Loading the conf
    config = {}
    with open(conf) as f:
        config = yaml.load(f)
    parameters = config["campaign"][test]

    sweeps = sweep(parameters)
    filtered_sweeps = [param for param in sweeps if accept(param)]
    sweeper = ParamSweeper(
        # Maybe puts the sweeper under the experimentation directory
        # This should be current/sweeps
        persistence_dir=os.path.join("%s/sweeps" % test),
        sweeps=filtered_sweeps,
        save_sweeps=True,
        name=test)
    params = sweeper.get_next(sort_params_by_nbr_clients)
    PROVIDERS[provider](broker=broker, config=config, env=test)
    t.inventory()

    while params:
        params.pop("backup_dir", None)
        params.update({"backup_dir": generate_id(params)})
        t.prepare(broker=broker)
        t.test_case_1(**params)
        sweeper.done(params)
        dump_param(params)
        params = sweeper.get_next(sort_params_by_nbr_clients)
        t.destroy()