def threadFunction(): # check the meta periodically addrList = metaclient.getServerAddr() addr = addrList[0] # if the value is not NULL while (1): value = metaclient.getMeta(addr, "meaningless") if (value == "NULL"): time.sleep(0.1) continue else: break endsim = timeit.default_timer() print("data is becoming meaningless, time span") print(endsim - startsim) metaclient.putMeta(addr, "simend", "simendInfo") os._exit(0)
if (rcode == -11): print("data not avaliable for ts %d" % (version)) time.sleep(0.5) continue patternHeppen = checkDataPatternCenter(getdata_p1) #the time used for predicates every time time.sleep(0.01) version = version + 1 if (patternHeppen == True): print( "---------patternHeppen at ts %d , write info to meta----------" % (version)) #only start on checking service #write meta data into server <ts lb ub> addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.putMeta(addr, "DATAOK", "testmeta:" + str(version)) endanay = timeit.default_timer() print("time span") print(endanay - startanay) addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.putMeta(addr, "FINISH", "tempFINISH") ds.finalize()
#ds.unlock_on_read(lock_name) # check if data ok if (rcode == -11): print("data not avaliable for ts %d" % (version)) time.sleep(0.25) continue patternHeppen = checkDataPatternCenter(getdata_p1) #the time used for predicates every time time.sleep(0.01) version = version + 1 if (patternHeppen == True): print( "---------patternHeppen at ts %d , write info to meta----------" % (version)) #only start on checking service #write meta data into server <ts lb ub> addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.putMeta(addr, "DATAOK", "testmeta:" + str(version)) break ds.finalize() endanay = timeit.default_timer() print("time span") print(endanay - startanay)
#extra data read time is not being counted time.sleep(0.01) #if(currIter>=iteration): # break version = version + 1 if (patternHeppen == True): #the time used for data analysis #fack calling the analytics here and find the data is meaningless after analysing time.sleep(0.05) print( "---------patternHeppen at ts %d, simulation data is meaningless----------" % (version)) # write to the meta server (the data is meaningless) addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.putMeta(addr, "meaningless", "meaningless info") break ds.finalize() endanay = timeit.default_timer() print("time span") print(endanay - startanay) addrList = metaclient.getServerAddr() addr = addrList[0] print("test get: ", metaclient.getMeta(addr, "testkey"))