def deployment_scripts_task(scenario_path, configuration, config_path, results_dir, logger): try: provider = configuration.provider if not configuration.skip_deployment: configuration.test_url = deploy(provider, config_path, results_dir, logger) configuration.save() logger.log("Showcase is deployed on %s\n" % configuration.test_url) logger.log("##############################") logger.log("# Running distributed JMeter #") logger.log("##############################") if not configuration.skip_test: jmeter_config_path = write_jmeter_config(configuration.test_url, configuration, config_path, results_dir, logger) run_test.run_test(provider, jmeter_config_path, scenario_path, results_dir, logger) logger.log("--------------------------------") logger.log("Finished", fin=True) logger.log("View results in %s" % results_dir) except Exception as e: import traceback logger.log(traceback.format_exc(), fin=True)
import logging import os import uuid import sys from cloudscale.deployment_scripts import deploy from cloudscale.deployment_scripts.logger import Logger class MyLogger(Logger): def log(self, msg, level=logging.INFO, append_to_last=False, fin=False): print msg if __name__ == "__main__": if len(sys.argv) == 3: config_path = sys.argv[2] infrastructure = sys.argv[1] logger = MyLogger() results_dir = "%s/results" % os.path.abspath(os.path.dirname(__file__)) url = deploy(infrastructure, config_path, results_dir, logger) print "Showcase is deployed on http://%s/showcase-1-a\n" \ "\n" \ "NOTE: You can copy above url to our application for distributed jmeter" % url else: print """Usage: python run.py <aws|openstack> <path_to_config>"""