def clear_replay_dirs(self, user, password): shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: try: results = shell.run( ["sudo", "/bin/rm", "-rf", "/replay_logdb"], cwd="/") cmd = shlex.split( "/bin/bash -c \"for i in $(ls /tmp); do sudo rm -r /tmp/$i; done\"" ) results = shell.run(cmd, cwd="/") except spur.results.RunProcessError: print "replay_logdb didn't exist... oh well" cmd = shlex.split( "/bin/bash -c \"for i in $(ls /replay_cache); do sudo rm -rf /replay_cache/$i; done\"" ) results = shell.run(cmd, cwd="/") results = shell.run(["sudo", "/bin/mkdir", "/replay_logdb"], cwd="/") results = shell.run(["sudo", "/bin/chmod", "777", "/replay_logdb"], cwd="/") results = shell.run(["sudo", "/bin/chmod", "777", "/replay_cache"], cwd="/")
def start_recv_files(self, user, password): shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: result = shell.run( ["./run_background_task.sh", "./recv_replay_files"], cwd=CLOUDLAB_STREAMSERVER_DIR)
def get_stats_files(self, user, password, out_files): output_file_prefix = out_files + str(self.num_partitions) taint_files = ["tar", "-zcf", "/tmp/taint-stats.tgz"] stream_files = ["tar", "-zcf", "/tmp/stream-stats.tgz"] for i in range(self.num_partitions): taint_files.append("/tmp/taint-stats-" + str(i)) stream_files.append("/tmp/stream-stats-" + str(i)) shell = experiment_utilities.open_ssh_session(self.ctrl_host.host, user, password) with shell: shell.run(taint_files, cwd="/") shell.run(stream_files, cwd="/") local_taint = output_file_prefix + ".taint-stats.tgz" local_stream = output_file_prefix + ".stream-stats.tgz" remote_taint = "/tmp/taint-stats.tgz" remote_stream = "/tmp/stream-stats.tgz" experiment_utilities.get_file(self.ctrl_host.host, user, password, local_taint, remote_taint) experiment_utilities.get_file(self.ctrl_host.host, user, password, local_stream, remote_stream)
def start_streamserver(self, user, password): shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: result = shell.run(["./run_background_task.sh", "./streamserver"], cwd=CLOUDLAB_STREAMSERVER_DIR) result = shell.run(["./run_background_task.sh", "./pound_cpu"], cwd=CLOUDLAB_STREAMSERVER_DIR)
def run_retaint_experiment(self, user, password, a): args = ["./retaint", self.replay_dir, "partitions.test"] #append any special per-test arguemnts to this test for arg in a: args.append(arg) shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: result = shell.run(args, cwd=CLOUDLAB_STREAMCTL_DIR) print >> sys.stderr, result.output
def get_retaint_stats_file(self, user, password, output_dir): shell = experiment_utilities.open_ssh_session(self.host, user, password) cmd = shlex.split( "/bin/bash -c \"/bin/tar -czf /tmp/retaint.tgz /tmp/*\"") rt_file = "/tmp/retaint.tgz" out_file = output_dir + "retaint.tgz" with shell: shell.run(cmd, cwd="/") experiment_utilities.get_file(self.host, user, password, out_file, rt_file)
def replace_prefix(self, user, password, prefix_name): shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: try: results = shell.run([ "sudo", "/bin/rm", CLOUDLAB_PREFIX_DIR + "/lib/ld-2.15.so" ], cwd="/") except spur.results.RunProcessError: print >> sys.stderr, "whoops, ld-2.15.so didn't exist yet" results = shell.run([ "sudo", "/bin/ln", "-s", "/local/src/omniplay/eglibc-2.15/loaders/" + prefix_name, CLOUDLAB_PREFIX_DIR + "/lib/ld-2.15.so" ], cwd="/")
def one_time_setup(self, user, password): shell = experiment_utilities.open_ssh_session(self.host, user, password) shell.run(["./insert_spec_emulab.sh"], cwd="/local/src/omniplay/scripts") try: shell.run(["sudo", "/bin/mkdir", "-p", LOCAL_PREFIX_DIR + "/lib/"], cwd="/") except spur.results.RunProcessError: print >> sys.stderr, "already made the home ld-2.15 directory" try: shell.run([ "sudo", "/bin/ln", "-s", CLOUDLAB_PREFIX_DIR + "/lib/ld-2.15.so", LOCAL_PREFIX_DIR + "/lib/ld-2.15.so" ], cwd="/") except spur.results.RunProcessError: print >> sys.stderr, "already linked in ld-2.15.so... move on"
def start_ctrl(self, user, password, flags): args = [ "time", "./streamctl", "partitions.test", "server.config", "-w" ] for item in flags: args.append(item) shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: try: shell.run( ["/bin/rm", "-r", CLOUDLAB_STREAMCTL_DIR + "/tmp_results"], cwd="/") except spur.results.RunProcessError: print >> sys.stderr, "whoops, tmp_results didn't exist yet" result = shell.run(args, cwd=CLOUDLAB_STREAMCTL_DIR) print >> sys.stderr, result.output
def one_time_setup(self, user, password): shell = experiment_utilities.open_ssh_session(self.host, user, password) shell.run(["./insert_spec_emulab.sh"], cwd="/local/src/omniplay/scripts") try: shell.run(["sudo", "/bin/mkdir", "-p", LOCAL_PREFIX_DIR + "/lib/"], cwd="/") except spur.results.RunProcessError: print >> sys.gstderr, "already made the home ld-2.15 directory" try: shell.run([ "sudo", "/bin/ln", "-s", CLOUDLAB_PREFIX_DIR + "/lib/ld-2.15.so", LOCAL_PREFIX_DIR + "/lib/ld-2.15.so" ], cwd="/") except spur.results.RunProcessError: print >> sys.stderr, "already linked in ld-2.15.so... move on" cmd = shlex.split( "/bin/bash -c \"for i in $(ls /replay_cache); do sudo rm -rf /replay_cache/$i; done\"" ) results = shell.run(cmd, cwd="/") try: results = shell.run(["sudo", "/bin/mkdir", "/replay_logdb"], cwd="/") except spur.results.RunProcessError: print >> sys.stderr, "alread made replay_logdb" results = shell.run(["sudo", "/bin/chmod", "777", "/replay_logdb"], cwd="/") results = shell.run(["sudo", "/bin/chmod", "777", "/replay_cache"], cwd="/")
def kill_pound_cpu(self, user, password): shell = experiment_utilities.open_ssh_session(self.host, user, password) with shell: shell.spawn(["pkill", "-9", "pound_cpu"])