def run(self): for config in RemoteSimulateConfig.parse(self.options.batch_config): print("=========================================================") print("Experiment started, config = {} ...".format(config)) print("kill remote conflux and cleanup logs ...") kill_remote_conflux(self.options.ips_file) cleanup_remote_logs(self.options.ips_file) setup_bandwidth_limit(self.options.ips_file, self.options.bandwidth, self.options.nodes_per_host) print("Run remote simulator ...") self.run_remote_simulate(config) print("Kill remote conflux and copy logs ...") kill_remote_conflux(self.options.ips_file) self.copy_remote_logs() # Do not cleanup logs here because they may be needed for debug later, and they will be deleted when the # next run begins # cleanup_remote_logs(self.options.ips_file) print("Statistic logs ...") os.system("echo throttling logs: `grep -i thrott -r logs | wc -l`") os.system("echo error logs: `grep -i thrott -r logs | wc -l`") print("Computing latencies ...") self.stat_latency(config) print("Collecting metrics ...") tag = self.tag(config) execute( "./copy_file_from_slave.sh metrics.log {} > /dev/null".format( tag), 3, "collect metrics") execute( "./copy_file_from_slave.sh conflux.log {} > /dev/null".format( tag), 3, "collect rust log") if self.options.enable_flamegraph: try: execute( "./copy_file_from_slave.sh conflux.svg {} > /dev/null". format(tag), 10, "collect flamegraph") except: print( "Failed to copy flamegraph file conflux.svg, please try again via copy_file_from_slave.sh in manual" ) execute("cp exp.log {}.exp.log".format(tag), 3, "copy exp.log") print("=========================================================") print("archive the experiment results into [{}] ...".format( self.stat_archive_file)) cmd = "tar cvfz {} {} *.exp.log *nodes.csv *.metrics.log *.conflux.log".format( self.stat_archive_file, self.stat_log_file) if self.options.enable_flamegraph: cmd = cmd + " *.conflux.svg" os.system(cmd)
def copy_remote_logs(self): execute("./copy_logs.sh > /dev/null", 3, "copy logs") os.system("echo `ls logs/logs_tmp | wc -l` logs copied.")