def run_all_with_script_runner(): scripts = glob.glob(os.path.join(os.path.dirname(__file__), 'script_*/script_*.py')) for script in scripts: print 'Begin processing script: {0}'.format(script) # clean directories first # script_runner.clean(os.path.dirname(script)) # print "\n cleaned script directory: {0}\n".format(os.path.dirname(script)) # run script and do post_run if it exists image_dir = os.path.join(os.path.dirname(script), 'images') (model, imp_script) = script_runner.load_model(script, image_dir) script_runner.run(model) print 'completed model run for: {0}'.format(script) if hasattr(imp_script, 'post_run'): imp_script.post_run(model) print 'completed post model run for: {0}'.format(script) # save model _state saveloc = os.path.join(os.path.dirname(script), 'save_model')
def run_all_with_script_runner(to_skip=[]): scripts = glob.glob( os.path.join(os.path.dirname(__file__), 'script_*/script_*.py')) print scripts for script in to_skip: scripts = [s for s in scripts if script not in s] print scripts for script in scripts: print 'Begin processing script: {0}'.format(script) # clean directories first # script_runner.clean(os.path.dirname(script)) # print "\n cleaned script directory: {0}\n".format(os.path.dirname(script)) # run script and do post_run if it exists image_dir = os.path.join(os.path.dirname(script), 'images') (model, imp_script) = script_runner.load_model(script, image_dir) script_runner.run(model) print 'completed model run for: {0}'.format(script) if hasattr(imp_script, 'post_run'): imp_script.post_run(model) print 'completed post model run for: {0}'.format(script) # save model _state saveloc = os.path.join(os.path.dirname(script), 'save_model')
def generate(script_pref): curr_dir = generated_dir + script_pref + "/" run(script_pref, True, True) acc = [] for folder in os.listdir(curr_dir): subdir = curr_dir + folder + "/" if not os.path.isdir(subdir): continue pcap_files = [ entry for entry in os.listdir(subdir)\ if os.path.isfile(subdir + entry) and\ entry.endswith(".pcap") ] if len(pcap_files) != 2: raise ValueError("Generation failed!") files_flag = "".join(" -f " + subdir + entry for entry in pcap_files) args = shlex.split("sudo ./bin/SnifferEx" + files_flag + cache_flag) proc = subpr.Popen(args, stdout=subpr.PIPE) out, err = proc.communicate() _info, _header, hit_rate = out.rpartition(hit_rate_header) acc.append(float(hit_rate)) return acc
def run_all_with_script_runner(to_skip=[]): scripts = glob.glob(os.path.join(os.path.dirname(__file__), 'script_*/script_*.py')) print scripts default_skip = ['script_ny_plume/script_ny_plume.py', 'script_ny_roms/script_ny_roms.py', 'script_tamoc/script_tamoc.py', 'script_tamoc/script_arctic_tamoc.py', 'script_tamoc/script_gulf_tamoc.py', 'script_TAP/script_old_TAP.py'] for script in to_skip: default_skip = [s for s in default_skip if script not in s] to_skip.extend(default_skip) for script in to_skip: scripts = [s for s in scripts if script not in s] print scripts for script in scripts: print 'Begin processing script: {0}'.format(script) # clean directories first # script_runner.clean(os.path.dirname(script)) # print "\n cleaned script directory: {0}\n".format(os.path.dirname(script)) # run script and do post_run if it exists image_dir = os.path.join(os.path.dirname(script), 'images') (model, imp_script) = script_runner.load_model(script, image_dir) script_runner.run(model) print 'completed model run for: {0}'.format(script) if hasattr(imp_script, 'post_run'): imp_script.post_run(model) print 'completed post model run for: {0}'.format(script) # save model _state saveloc = os.path.join(os.path.dirname(script), 'save_model')
scripts = glob.glob(os.path.join(os.path.dirname(__file__), 'script_*/script_*.py')) for script in scripts: print 'Begin processing script: {0}'.format(script) # clean directories first # script_runner.clean(os.path.dirname(script)) # print "\n cleaned script directory: {0}\n".format(os.path.dirname(script)) # run script and do post_run if it exists image_dir = os.path.join(os.path.dirname(script), 'images') (model, imp_script) = script_runner.load_model(script, image_dir) script_runner.run(model) print 'completed model run for: {0}'.format(script) if hasattr(imp_script, 'post_run'): imp_script.post_run(model) print 'completed post model run for: {0}'.format(script) # save model _state saveloc = os.path.join(os.path.dirname(script), 'save_model') # make sure it is rewound so we're not doing a MIDRUN save # which does not currently work model.rewind()
#!/usr/bin/python3 import sys from script_runner import parse_args, run if __name__ == "__main__": args = parse_args(sys.argv[1:]) run("browser", False, args.sep)
#!/usr/bin/python3 import sys from script_runner import parse_args, run if __name__ == "__main__": args = parse_args(sys.argv[1:]) run("download", False, args.sep)
#!/usr/bin/python3 import sys from script_runner import parse_args, run if __name__ == "__main__": args = parse_args(sys.argv[1:]) run("video", False, args.sep)
scripts = glob.glob( os.path.join(os.path.dirname(__file__), 'script_*/script_*.py')) for script in scripts: print 'Begin processing script: {0}'.format(script) # clean directories first # script_runner.clean(os.path.dirname(script)) # print "\n cleaned script directory: {0}\n".format(os.path.dirname(script)) # run script and do post_run if it exists image_dir = os.path.join(os.path.dirname(script), 'images') (model, imp_script) = script_runner.load_model(script, image_dir) script_runner.run(model) print 'completed model run for: {0}'.format(script) if hasattr(imp_script, 'post_run'): imp_script.post_run(model) print 'completed post model run for: {0}'.format(script) # save model _state saveloc = os.path.join(os.path.dirname(script), 'save_model') # todo: maybe separate this since it is currently not working ## make sure it is rewound so we're not doing a MIDRUN save ## which does not currently work