예제 #1
0
def threadFunction():

    # check the meta periodically
    addrList = metaclient.getServerAddr()
    addr = addrList[0]

    # if the value is not NULL

    while (1):
        value = metaclient.getMeta(addr, "simend")
        if (value == "NULL"):
            time.sleep(0.1)
            continue
        else:
            break

    endsim = timeit.default_timer()
    print("sim end, stop the ana")
    os._exit(0)
예제 #2
0
def threadFunction():

    # check the meta periodically
    addrList = metaclient.getServerAddr()
    addr = addrList[0]

    # if the value is not NULL

    while (1):
        value = metaclient.getMeta(addr, "FINISH")
        if (value == "NULL"):
            time.sleep(0.1)
            continue
        else:
            break

    print("sim is finish, stop")
    print("prepare time: ", prepareTime)
    print("actual work time: ", actualworkTime)
    os._exit(0)
예제 #3
0
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)
예제 #4
0
def threadCheckFinish():

    # check if there is finish meta data
    addrList = metaclient.getServerAddr()
    addr = addrList[0]

    while (1):
        value = metaclient.getMeta(addr, "FINISH")
        if (value == "NULL"):
            print("not finish")
            time.sleep(0.5)
            continue
        else:
            print("sim finish")
            while (1):
                if (runningTask == 0):
                    metaclient.Recordtimetick(addr, "TOTAL")
                    os._exit(0)
                else:
                    time.sleep(0.1)
                    print("running task ", runningTask)
                    continue
예제 #5
0
    print("actual work time: ", actualworkTime)
    os._exit(0)


thread = Thread(target=threadFunction)
thread.start()
print("start the thread watching the metaserver for task finish")

initanayok = timeit.default_timer()

prepareTime = prepareTime + initanayok - startanay

while (1):
    startcheck = timeit.default_timer()
    # use consume pattern
    value = metaclient.getMeta(addr, "DATAOK")
    print("get value", value)
    if (value == "NULL"):
        time.sleep(0.5)
        endcheck = timeit.default_timer()
        prepareTime = prepareTime + endcheck - startcheck
        continue
    else:
        # pull real data once
        getdata_p1, rcode = ds.get(var_name, ts, lb, ub)
        endcheck = timeit.default_timer()
        prepareTime = prepareTime + endcheck - startcheck
        actualworkTime = actualworkTime + 0.5

ds.finalize()
예제 #6
0
    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

addrList = metaclient.getServerAddr()
addr = addrList[0]
metaclient.Recordtime(addr, "SIM")

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"))