if HomeDir.endswith("shu"): WORKDIR = os.path.expanduser("~") elif HomeDir.endswith("srallap"): WORKDIR = os.path.expanduser("~") + "/eeg" configfile = "conf.txt" from_conf = get_conf_int(configfile, "from_conf") from_tasklist = get_conf_int(configfile, "from_tasklist") dataSetsDir = get_conf(configfile, "dataSetsDir" + User) dataProcDir = get_conf(configfile, "dataProcDir" + User) rawfolder = get_conf(configfile, "rawfolder") metafolder = get_conf(configfile, "metafolder") datafolder = get_conf(configfile, "datafolder") datasets = get_list_startswith(configfile, "datasets") datapaths = [dataSetsDir + "/" + tmp + "/" for tmp in datasets] if iprint: print(datapaths) for i in range(len(datapaths)): confsuffix = datasets[i] path = datapaths[i] conf = conf = "conf/conf-" + confsuffix + ".txt" iflist = glob.glob(path + "/" + rawfolder + "/*") params = {} params["MetaDir"] = metafolder params["DataDir"] = datafolder params["rawfolder"] = rawfolder params["downsample"] = get_conf_int(conf, "downsample")
serverip = read_lines_as_list(flist[i]) serverip = serverip[0] servers.append(serverip) tmp = memcache.Client([serverip + ":11211"]) ret = tmp.set("tmp", 1, time=10) val = tmp.get("tmp") if not (ret and val): print("-- Cache server fail: " + flist[i], serverip) mc_ind = flist[i].split(".")[0].lstrip(mcdir + "/cache_server") print("-- Run this cmd at login node:") print("jbsub -interactive -queue x86_7d -mem 40g sh " + WORKDIR + "/memcached/start.sh " + mc_ind) sys.exit(0) datasets = get_list_startswith(configfile, "datasets") dataname = datasets[dataindex] print(__file__.split("/")[-1], dataindex, datasets, dataname) mc = memcache.Client([tmp + ":11211" for tmp in servers], server_max_value_length=CACHE_SIZE) conf = "conf/conf-" + dataname + ".txt" cache_prefix = get_conf(conf, "cache_prefix") if iprint: print("cache_prefix=", cache_prefix, servers) def mc_get(ind, key, pref=cache_prefix): # ind subj return mc.get(pref + "s%d" % ind + key) def mc_set(ind, key, val, time=CACHE_TIME, pref=cache_prefix):