def inner(srv, run_id, accum): root = getRoot(accum) script = script_ # seems necessary for maintaining script in scope if not script.endswith('.java'): script += '.java' path = rjoin(root, inject_folder_name) cmd = 'javac -cp %s/*.jar %s' % (path, rjoin(path, script)) logger.info('execute: ' + cmd) print_remote_out( srv.execute(cmd))
def inner(srv, run_id, accum): root = getRoot(accum) path = rjoin(root, inject_folder_name, "run") cmd = "cd %s; chmod -R 777 *; ./%s -c %s" % (path, command, program) logger.info("execute: " + cmd) print_remote_out(srv.execute(cmd))
def inner(srv, run_id, accum): root = getRoot(accum) logger.info("bob on host: " + getMetadata(accum).get("host")) command = "run_bob" path = rjoin(root, inject_folder_name, "run") cmd = r"cd %s; echo %d | ./%s -r %s abcdefghijk 4" % (path, fortune, command, program) logger.info("execute: " + cmd) t1 = clock() (stdout, stderr) = srv.execute(cmd) t2 = clock() print_remote_out((None, stderr)) logger.info("".join(stdout).replace("\n", ". ")) logger.info("execution time took %d seconds" % (t2 - t1))
def put_my_init_file(srv, run_id, accum): my_tag = getTag(accum) root = getRoot(accum) lpath = ljoin(ctx.local_output_dir, my_tag+'.ini') put(srv, lpath, rjoin(root, 'inject'))
def let_my_millionaire_participate(srv, run_id, accum): tag = getTag(accum) root = getRoot(accum) params = '--no-ssl {my_initfile}'.format(my_initfile=(rjoin(root,'inject', tag+'.ini'))) execute_injected_python_script(srv, 'millionaires', root, params)
def inner(srv, run_id, accum): root = getRoot(accum) path = rjoin(root, inject_folder_name) cmd = 'java -cp %s/.:%s/* %s %s' % (path, path, script, remote_results_dir_F(root)) logger.info('execute: ' + cmd) print_remote_out( srv.execute(cmd) )
slave4 : ('hello world', lambda srv, run_id, accum: logger.info('hello world from %s' % run_id)), }, # tier 2: setup # setup four remote servers, # slave1: setup with access to slave_script_1.py # slave2: setup with access to slave_script_2.py # slave3: setup with access to slave_script_2.py : duplicates are allowed # slave4: setup with access to slave_script_3 : which is a folder # containing slave_script_3.py, slave_script_4.py, and some additiona lib files # # tier 3: setup the slaves for later script execution # it is possible to partially specify what the containing remote folder should be named # which is practical for repeated executions without removal # if none is specified, a unique temporary folder is created { slave1 : ('setup script 1.', deploy(rjoin(ipath, 'slave_scripts', 'slave_script_1.py'), 'test_framework/slave1')), slave2 : ('setup script 2.', deploy(rjoin(ipath, 'slave_scripts', 'slave_script_2.py'), 'test_framework/slave2')), slave3 : ('setup script 2. again ', deploy(rjoin(ipath, 'slave_scripts', 'slave_script_2.py'), 'test_framework/slave3')), slave4 : ('setup folder with script 3, 4, 5', deploy(rjoin(ipath, 'some_other_slave_scripts'), 'test_framework/slave4')), }, # tier 4: call a script and see how the logger handles remote prints # call slave_script 3: which simply prints to stdout what parameters is gets # this is an example of directly executing a remote script. # note the necessity of supplying a function which takes srv, run_id and accum # note also how to get the name of the root folder (as it might be generated on runtime, we need this) # should simply be evident in the log output { slave4 : ('echo', lambda srv, run_id, accum : execute_injected_python_script(srv, 'slave_script_3.py', getRoot(accum), {'Sherlock Holmes':'Arthur Conan Doyle', 'Conan the barbarian': 'Robert E. Howard'})),
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)