Esempio n. 1
0
def keystone_exp():
    sweeper = ParamSweeper(SWEEPER_DIR,
                           sweeps=sweep({
                               'db': DATABASES,
                               'delay': DELAYS,
                               'db-nodes': CLUSTER_SIZES
                           }))

    while sweeper.get_remaining():
        combination = sweeper.get_next()
        logging.info("Treating combination %s" % pformat(combination))

        try:
            # Setup parameters
            conf = copy.deepcopy(CONF)  # Make a deepcopy so we can run
            # multiple sweeps in parallels
            conf['g5k']['resources']['machines'][0]['nodes'] = combination[
                'db-nodes']
            conf['tc']['constraints'][0][
                'delay'] = "%sms" % combination['delay']
            db = combination['db']
            locality = False
            xp_name = "%s-%s-%s" % (db, combination['db-nodes'],
                                    combination['delay'])

            # Let's get it started hun!
            j.deploy(conf, db, locality, xp_name)
            j.openstack(db)
            j.emulate(conf['tc'])
            j.rally(SCENARIOS, "keystone")
            j.backup()

            # Everything works well, mark combination as done
            sweeper.done(combination)
            logging.info("End of combination %s" % pformat(combination))

        except Exception as e:
            # Oh no, something goes wrong! Mark combination as cancel for
            # a later retry
            logging.error("Combination %s Failed with message %s" %
                          (pformat(combination), e))
            sweeper.cancel(combination)

        finally:
            teardown()
Esempio n. 2
0
def read_write_ratio():
    results = {}
    db_host = None

    # Get the address of the database
    with open(os.path.join(JOB_NAME, 'env'), "r") as f:
        db_host = yaml.load(f)['roles']['database'][0]
        logging.info("Database is %s", db_host)

    for scn in SCENARIOS:
        logging.info("Treating scenario: %s" % scn)
        # Gets total reads/writes in the database; then executes rally
        # scenario; and finally re-gets total reads/writes.
        total_reads_before_scn, total_writes_before_scn = total_reads_writes(
            db_host.address)
        j.rally([scn], "keystone")
        total_reads_after_scn, total_writes_after_scn = total_reads_writes(
            db_host.address)

        # Compute number of reads/writes for this scenario and its ratio
        scn_reads = total_reads_after_scn - total_reads_before_scn
        scn_writes = total_writes_after_scn - total_writes_before_scn
        scn_rws = scn_reads + scn_writes

        results[scn] = {
            'reads': scn_reads,
            'writes': scn_writes,
            '%reads': round((scn_reads / scn_rws) * 100, 2),
            '%writes': round((scn_writes / scn_rws) * 100, 2)
        }

        # Log the ratio result
        logging.info("Ratio for %s: %s" % (scn, results[scn]))

    # Output results
    pprint(results)