示例#1
0
def sendEventToPubSub(ts):

    addrList = pubsubclient.getServerAddr()
    print (addrList)

    addr = addrList[0]

    eventList = ["dataPattern_1"]
    # this shoule be deleted
    clientId = "test" + "_" + str(ts)
    metainfo = "GRID[<-1,-1>:<-1,-1>]%TS["+str(ts)+"]"
    matchtype = "NAME"
    pubsubclient.publishEventList(addr,eventList,clientId,metainfo,matchtype)
示例#2
0
文件: sim.py 项目: wangzhezhe/TPST
confpath = serverdir+"/conf*"

copyCommand = "cp "+confpath+" ."

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"


ds = dataspaces.dataspaceClient(appid,comm)
pubsubaddrList = pubsubclient.getServerAddr()
print (pubsubaddrList)
pubsubAddr = pubsubaddrList[0]

#pubsubaddrList = pubsubclient.getServerAddr()
#print (pubsubaddrList)

#pubsubAddr = pubsubaddrList[0]

def putDataToDataSpaces(gridList,timestep):

    cellDataArray=[]
    for i in range (len(gridList)):
        #print gridList[i].p
        cellDataArray.append(gridList[i].p*1.0)