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
import ctypes import os import time import math import timeit import sys sys.path.append('../../../src/publishclient/pythonclient') import pubsub as pubsubclient sys.path.append('../../../src/metadatamanagement/pythonclient') import metaclient addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.Recordtimetick(addr, "TIMET") gridnum = 50 # input the coordinate of the points and return the index of grid in array comm = MPI.COMM_WORLD rank = comm.Get_rank() def sendEventToPubSub(ts): addrList = pubsubclient.getServerAddr() print(addrList) addr = addrList[0]
time.sleep(0.1) continue else: break print("rank %d get meta %s" % (rank, value)) #assume those info is required from the metadata ts = 11 lb = [0] ub = [gridnum * gridnum * gridnum * (1) - 1] var_name = "ex1_sample_data" addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.Recordtimetick(addr, "TIMET") # pull real data once startpull = timeit.default_timer() getdata_p1, rcode = ds.get(var_name, ts, lb, ub) endpull = timeit.default_timer() print("pull data ", endpull - startpull) # time it addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.Recordtimetick(addr, "SIMDATAOK") # do real analytics
# anakey = "ANA_"+str(rank) # metaclient.Recordtime(addr, anakey) #assume those info is required from the metadata ts = 11 gridnum = 50 lb = [0] ub = [gridnum * gridnum * gridnum * (1) - 1] var_name = "ex1_sample_data" getdata_p1, rcode = ds.get(var_name, ts, lb, ub) endpull = timeit.default_timer() print("pull data ", endpull - startpull) print("do real analytics") time.sleep(1) addrList = metaclient.getServerAddr() addr = addrList[0] metaclient.Recordtimetick(addr, "TOTAL") ds.finalize() # time it # addrList=metaclient.getServerAddr() # addr = addrList[0] # metaclient.Recordtime(addr, anakey) # do real analytics
os.system(copyCommand) # number of clients at clients end to join server num_peers= 2 appid = 1 var_name = "ex1_sample_data" #lock_name = "my_test_lock_"+str(rank) lock_name = "my_test_lock" ds = dataspaces.dataspaceClient(appid,comm) # check the meta periodically addrList =metaclient.getServerAddr() addr = addrList[0] metaclient.Recordtimetick(addr, "SCHEDULE") anakey = "ANA_"+str(rank) metaclient.Recordtime(addr, anakey) #assume those info is required from the metadata ts = 10 lb=[0] ub=[15*15*15*(1)-1] var_name = "ex1_sample_data" # pull real data once getdata_p1,rcode = ds.get(var_name, ts, lb, ub)
# fetch the real data # record the time from mpi4py import MPI import numpy as np import dataspaces.dataspaceClient as dataspaces import ctypes import os import time import math import timeit import sys sys.path.append('../../../src/publishclient/pythonclient') import pubsub as pubsubclient sys.path.append('../../../src/metadatamanagement/pythonclient') import metaclient comm = MPI.COMM_WORLD rank = comm.Get_rank() appid = 3 # check the meta periodically addrList =metaclient.getServerAddr() addr = addrList[0] metaclient.Recordtimetick(addr, "ANASTART")