def run_map_ms_commands(): if (RANK == 0): print "RUN map_ms_commands()..." k10 = kmr0.make_kvs(value="cstring") if (RANK == 0): for i in range(0, 20): k10.add(("index=" + str(i)), ("sleep 3")) k10.add_kv_done() k11 = k10.sort() s11 = kmr4py.listify(k11) k12 = k11.map_ms_commands(identitymap, nothreading=True, separator_space=True, value="cstring") k13 = k12.sort() assert (kmr4py.listify(k13) == s11) k13.free()
def run_map_ms(): if (RANK == 0): print "RUN map_ms()..." k00 = kmr0.make_kvs() if (RANK == 0): for w in PHONETIC: k00.add(w[0:2], w) k00.add_kv_done() k01 = k00.sort() s01 = kmr4py.listify(k01) ## (NOTHREADING IS NEEDED???; HANGS OFTEN IF OMIT) k02 = k01.map_ms(identitymap, nothreading=True) k03 = k02.sort() assert (kmr4py.listify(k03) == s01) k03.free() return 0
if (RANK == 0): sys.stderr.write("Usage: python eprun.py [options] input-file.\n") sys.exit(1) if (opts.trace): kmr0.set_option("trace_map_ms", "1") threading = (opts.percore) sys.stdout.flush() sys.stderr.flush() k20 = read_commands(args[0]) k21 = k20.map_ms_commands(read_result, nothreading=(not threading), separator_space=False, value="cstring") k22 = k21.replicate(rank_zero=True) if (RANK == 0): resultlist = kmr4py.listify(k22) valuelist = map(itemgetter(1), resultlist) ##print resultlist print valuelist k22.free() kmr0.dismiss() sys.stdout.flush() sys.stderr.flush() #time.sleep(1) #if (RANK == 0): # print "eprun OK" #sys.stdout.flush()
(7, "nana"), (8, "ya"), (9, "kono"), (10, "toe"), ] LL = len(XX) YY = [] for i in range(0, NPROCS): YY.extend(XX) k00 = kmr0.make_kvs(key="integer") for (k, v) in XX: k00.add(k, v) k00.add_kv_done() s00 = kmr4py.listify(k00) assert s00 == XX k00.free() k01 = kmr0.make_kvs(key="float8") for (k, v) in XX: k01.add(float(k), v) k01.add_kv_done() sxx = map((lambda (k, v): (float(k), v)), XX) s01 = kmr4py.listify(k01) assert s01 == sxx k01.free() k02 = kmr0.make_kvs(key="opaque", value="cstring") for (k, v) in XX: k02.add(k, v)