def vagrant_benchmark(attempt_info, database, benchmark, deploy_id=1): # run the benchmark vagrant_setup() out = None temp_dir = None try: import json attempt_info_file_path = os.path.join(vagrant_dir, 'attempt_info.json') with open(attempt_info_file_path, 'w') as attempt_info_file: json.dump(attempt_info, attempt_info_file) command = '{} && {}'.format( cd(vagrant_dir), 'vagrant ssh -c "{}"'.format( 'python /vagrant/core/scripts/vagrant_benchmark.py --attempt_info="{attempt_info}" --deploy_id={deploy_id} {database} {benchmark}' .format( attempt_info=os.path.join('/vagrant', 'attempt_info.json'), deploy_id=deploy_id, database=' '.join('--{}={}'.format(key, value) for key, value in database.iteritems()), benchmark=' '.join( '--{}={}'.format(key, value) for key, value in benchmark.iteritems())))) out = os.system(command) return out except: traceback.print_exc() finally: try: vagrant_clear() except: pass return out
def vagrant_deploy(repo, deploy_id, database): set_vagrant_database() out = os.system('{} && {}'.format( cd(vagrant_dir), 'vagrant ssh -c "{}"'.format( 'python /vagrant/core/scripts/vagrant_deploy.py {} {} {}'.format( repo, deploy_id, database)))) unset_vagrant_database() return out
def vagrant_deploy(repo, deploy_id, database): set_vagrant_database() out = os.system('{} && {}'.format( cd(vagrant_dir), 'vagrant ssh -c "{}"'.format( 'python /vagrant/core/scripts/vagrant_deploy.py {} {} {}'.format(repo, deploy_id, database)))) unset_vagrant_database() return out
def vagrant_benchmark(attempt_id, deploy_id, database, benchmark): # run the benchmark set_vagrant_database() command = '{} && {}'.format( cd(vagrant_dir), 'vagrant ssh -c "{}"'.format( 'python /vagrant/core/scripts/vagrant_benchmark.py --attempt={attempt_id} --deploy_id={deploy_id} {database} {benchmark}' .format(attempt_id=attempt_id, deploy_id=deploy_id, database=' '.join('--{}={}'.format(key, value) for key, value in database.iteritems()), benchmark=' '.join('--{}={}'.format(key, value) for key, value in benchmark.iteritems()) ) ) ) out = os.system(command) unset_vagrant_database() return out
def to_env(path): return '{} && {}'.format(cd(path), 'source bin/activate')