Example #1
0
fetch of remote results and logfiles, 
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
Example #2
0
	synch it with local output/slavetag/results.r file
	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) }	]

Example #3
0
def execute_deploy_1():
	''' helper method for hierarchy 1 '''
	
	localpath = ljoin(ipath, 'viff_three_millionaires')
	remote_root = rjoin('test_framework', 'benchmarking_example')
	return deploy(localpath, remote_root)
Example #4
0
def execute_deploy_4():
	''' helper method for hierarchy 4 '''
	
	localpath = ljoin(ipath, 'fib')
	remotepath = rjoin('test_framework', 'benchmarking_example')
	return deploy(localpath, remotepath)
Example #5
0
def execute_deploy_2():
	''' helper method for hierarchy 2 '''
	
	localpath = ljoin(ipath, 'fairplay_two_millionaires')
	remote_root = rjoin('test_framework', 'benchmarking_example')
	return deploy(localpath, remote_root)
Example #6
0
    deploy,
    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
Example #7
0
 *  From poorest to richest:
 *  Millionaire 1
 *  Millionaire 2 (119 millions)
 *  Millionaire 3 
	
In this case bob had a larger fortune than alice
-------------------------------------------------------------------------------
'''

from master_lib.collection import deploy, Master, vtf
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')


#setup logger
logger = setupLogger(master_log_path_F(), DEBUG, None)


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


#hierarchy
thread_hierarchy = [