def teardown(): try: j.destroy() j.emulate(CONF['tc']) except Exception as e: logging.warning( "Setup went wrong. This is not necessarily a bad news, " "in particular, if it is the first time you run the " "experiment: %s" % e)
def init(): try: j.g5k(config=CONF) j.inventory() j.destroy() j.emulate(CONF['tc']) except Exception as e: logging.error("Setup goes wrong. This is not necessarily a bad news, " "in particular, if it is the first time you run the " "experiment: %s" % e)
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()