예제 #1
0
파일: runner.py 프로젝트: tugend/Jalapeno
def execute_fairplay(player, **kwargs):
	if player == 'bob': cmd = cmd_for_bob(**kwargs)
	else: cmd = cmd_for_alice(**kwargs)

	root = kwargs.get('root')
	fortune = kwargs.pop('fortune')

	logger = setupLogger(remote_logs_dir_F(root), DEBUG, DEBUG)

	logger.info('begin ~')
	path = rjoin(root, inject_folder_name, 'run')
	results_wrapper()(ubt.benchmark_wrapper()(lambda : do(cmd, fortune, path)))()
	logger.info('end ~')
예제 #2
0
파일: usecase.py 프로젝트: tugend/Jalapeno
	and delete the remote folder 
	
print results:
	outprint the local results file together with the accumulated parameters for the thread
-------------------------------------------------------------------------------
'''

from shared_lib.collection import setupLogger, INFO, ljoin, master_log_path_F, ctx
from master_lib.collection import jtf, deploy, handle_results_print, fetch_and_teardown, Master


# setup logger
import injections
ipath = ''.join(injections.__path__)
ctx.local_output_dir = ljoin(ipath, 'output')
logger = setupLogger(master_log_path_F(), INFO, INFO)


# define slave tags
slaves = [ { 'tag' : 'slave1', },]


# hierarchy
thread_hierarchy = [	{ 'slave1' : ('setup', deploy(ljoin(ipath, 'java_inject'), 'test_framework/mytmp_java')) },
                		{ 'slave1' : ('compile java', jtf.compile_java('Example')) },
						{ 'slave1' : ('run java', jtf.run_java('Example')) },
						{ 'slave1' : ('fetch and delete', fetch_and_teardown) },
						{ 'slave1' : ('print results', handle_results_print) }	]


Master(slaves, thread_hierarchy).run()  
예제 #3
0
파일: runner.py 프로젝트: tugend/Jalapeno
wrapping the function in a results wrapper and
a benchmark wrapper.

Notice how the optional timeout parameter is managed.
-------------------------------------------------------------------------------
"""

import sys
from shared_lib.collection import ubt 
from shared_lib.collection import \
	setupLogger, DEBUG, remote_logs_dir_F, root, \
	results_wrapper, parse_params 
	
	
# _Setup logger_
logger = setupLogger(remote_logs_dir_F(root), DEBUG, DEBUG)


# _Fib, the function to be tested_
def fib(x):
	if x < 3: return x
	else: return fib(x-1) + fib(x-2)
	
	
#
# Results wrapper and benchmark wrapper  
# transparently handles benchmarking,  
# the given script and saves it to a results file
#     
if __name__ == '__main__':
	params = parse_params(sys.argv)
예제 #4
0
파일: usecase.py 프로젝트: tugend/Jalapeno
purge of the remote directory,
error handling and remote logging
-------------------------------------------------------------------------------
'''

from master_lib.collection import Master, getRoot, print_accum, \
execute_injected_python_script, fetch_and_teardown, rjoin, deploy, handle_results_print
from shared_lib.collection import setupLogger, ljoin, master_log_path_F, ctx

def throw_exc(): raise Exception('This is a locally grown exception!')

# setup -----------------------------------------------------------
import injections 
ipath = ''.join(injections.__path__) 
ctx.local_output_dir = ljoin(ipath, 'output')
logger = setupLogger(master_log_path_F(), ctx.cmd_log_level, ctx.file_log_level)

ctx.hosts = ['host1', 'host2', 'host3', 'host4']
ctx.username = '******'
ctx.private_key = 'insert key path here'

# named slaves - each to execute functions in parallel on different machines
slave1 = 'slave1'
slave2 = 'slave2'
slave3 = 'slave3'
slave4 = 'slave4'


# config uses a dict, to make it easy to extend 
# with more specific configuration options
slave_data = [  { 'tag' : slave1, }, 
예제 #5
0
파일: usecase.py 프로젝트: tugend/Jalapeno
"""

from db_adaptor import handle_results_db
from shared_lib.collection import setupLogger,  INFO, DEBUG, ljoin, rjoin, ctx
from master_lib.collection import handle_results_print, deploy, \
                                  fetch_and_teardown, Master, ftf, vtf, \
                                  getRoot, getHosts, getTag, \
                                  execute_injected_python_script
#
#Housekeeping
#------------------------------------------------------------------------------
#Setup of logger  
#Define slave tags   
#Overwrite default hosts, username and private key  
#
logger = setupLogger('output/master_logs', DEBUG, INFO)

slaves = [ 
	{ 'tag' : 'bob', },	
   	{ 'tag' : 'alice', },
   	{ 'tag' : 'conrad', }, 
] 

import injections
ipath = ''.join(injections.__path__) 

#
#Define thread hierarchy 1
#------------------------------------------------------------------------------
#Benchmark the Viff program 'millionaire'.  
#**First tier**: deploy  
예제 #6
0
파일: usecase.py 프로젝트: tugend/Jalapeno
    fetch_and_teardown,
    Master,
    vtf,
    rjoin,
    execute_injected_python_script,
    getRoot,
    getTag,
)
from shared_lib.collection import setupLogger, DEBUG, ctx, ljoin, master_log_path_F


import injections

ipath = "".join(injections.__path__)
ctx.local_output_dir = ljoin(ipath, "output")
logger = setupLogger(master_log_path_F(), DEBUG, None)


# define slave tags
slaves = [{"tag": "slave1"}, {"tag": "slave2"}, {"tag": "slave3"}]


def calculate(srv, run_id, accum):
    root = getRoot(accum)
    tag = getTag(accum)
    params = "--no-ssl {my_initfile}".format(my_initfile=rjoin(root, "inject", tag + ".ini"))
    execute_injected_python_script(srv, "benchmark.py", root, params)


# hirarchy
thread_hierarchy = [