Exemple #1
0
from ChordDHT import DHTnode as Node
import time, random
from threading import Thread
import multiprocessing

port = 9100

if __name__ == '__main__':


    n1 = Node("127.0.0.1",port+1)
    n2 = Node("127.0.0.1",port+2)

    time.sleep(1)

    n1.create()
    print "yay1"
    n2.join(n1.name)
    print "yay2"

    time.sleep(1)

    nodes = [n1,n2]
    for i in range(3,5):
        n = Node("127.0.0.1",port+i)
        print "yay"+str(i)
        print "started", n
        n.join(random.choice(nodes).name)
        nodes.append(n)
        time.sleep(1.0)
Exemple #2
0
 def __init__(self,host,ip):
     DHTnode.__init__(self,host,ip)
     self.addNewFunc(self.doMapReduce,"doMapReduce")
from ChordDHT import DHTnode as Node
import time, random

port = 9200


n1 = Node("127.0.0.1",port+1)
n2 = Node("127.0.0.1",port+2)

n1.join("http://127.0.0.1:9101")
print "yay1"

time.sleep(3)

n2.join("http://127.0.0.1:9101")
print "yay2"
"""
time.sleep(1)

nodes = [n1,n2]
for i in range(3,10):
    time.sleep(1.0)
    n = Node("127.0.0.1",port+i)
    print "yay"+str(i)
    print "started", n
    n.join(random.choice(nodes).name)
    nodes.append(n)



print "prepare to sleep"