def main(match_funcs = None, num_parallel = 1): if not match_funcs: fs_list = fsop.get_all_fs() match_funcs = fsop.get_matched_ops(fs_list, "*") if num_parallel > 1: pool = mp.Pool(num_parallel) results = [pool.apply_async(match_each, args=(x,)) for x in match_funcs] while 1: if len(results) == 0: break print "> Unfinished jobs : ", len(results) print next_results = [] for res in results: try: print res.get(False), except mp.TimeoutError: next_results.append(res) time.sleep(2) results = next_results for funcs in match_funcs: match_each(funcs) return
def cmd_grep_decl(opts, args): """grep common fields (e.g., 'grep_decl ext4')""" if len(args) == 0: args = fsop.get_all_fs() for fs in args: fsop.dump_known_ops(os.path.join(opts.linux, "fs", fs))
def simple_mp_fs(fn, args): if len(args) == 0: args = fsop.get_all_fs() pool = mp.Pool(mp.cpu_count()) for fs in args: pool.apply_async(fn, args=(fs,)) pool.close() pool.join()
def simple_mp_fs(fn, args): if len(args) == 0: args = fsop.get_all_fs() pool = mp.Pool(mp.cpu_count()) for fs in args: pool.apply_async(fn, args=(fs, )) pool.close() pool.join()
def cmd_status(opts, args): """check status of merge/clang""" def _get_size(pn): if pn is None or not os.path.exists(pn): return 0 return os.stat(pn).st_size for fs in fsop.get_all_fs(): one = _get_merged_file(fs) fss = _get_fss_file(fs) print "%-10s %10s B %10s B" % (fs, _get_size(one), _get_size(fss))
def main(): fs_list = fsop.get_all_fs() print fs_list fs_func_dic = load_all_available_funcs_by_fs(fs_list) num_parallel = 30 pool = mp.Pool(num_parallel) results = [pool.apply_async(count_fs, args=(fs,fs_func_dic[fs])) \ for fs in fs_list] pool.close() pool.join() for res in results: print res.get(False) #res = count_fs(fs) return
def main(match_funcs = None, num_parallel = 1): if not match_funcs: fs_list = fsop.get_all_fs() match_funcs = fsop.get_matched_ops(fs_list, "*") if num_parallel > 1: pool = mp.Pool(num_parallel) results = [pool.apply_async(match_each, args=(x,)) for x in match_funcs] pool.close() pool.join() for res in results: try: print res.get(False) except: print("") else: for funcs in match_funcs: print match_each(funcs) return
def main(match_funcs=None, num_parallel=1): if not match_funcs: fs_list = fsop.get_all_fs() match_funcs = fsop.get_matched_ops(fs_list, "*") if num_parallel > 1: pool = mp.Pool(num_parallel) results = [ pool.apply_async(match_each, args=(x, )) for x in match_funcs ] pool.close() pool.join() for res in results: try: print res.get(False) except: print("") else: for funcs in match_funcs: print match_each(funcs) return