コード例 #1
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, }, 
コード例 #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
ファイル: 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 = [