Exemplo n.º 1
0
import sys
sys.path.append("../")
from Piranha import config
from Corellia import Client
from Thinkpol import Agent
from gevent import sleep

miniture_host, miniture_port = config.miniture_addr
miniture_port += 1
Smith = Agent((miniture_host, miniture_port))
c = Client(("localhost", config.supervisor_port))

# c.add(5)
# sleep(0.5)
# print Smith.fetch()

# c.reduce(3)
# sleep(0.5)
# print Smith.fetch()

# c.restart([1212])
# print Smith.fetch()

c.stop([1215])
print Smith.fetch()
Exemplo n.º 2
0
import sys;sys.path.append("../")
from Piranha import config
from Thinkpol import Agent
import Corellia


def add_mod(name, mod, num):
    k = Corellia.Client(("localhost", 9999))
    for _ in xrange(num):
        key = k.push_task("common", ("register", (name, mod)))

def del_mod(name, num):
    k = Corellia.Client(("localhost", 9999))
    for _ in xrange(num):
        key = k.push_task("common", ("unregister", (name,)))


if __name__ == '__main__':
    def add(x, y):
        return x+y

    add_mod("add", add, 3)
    # del_mod("add", 2)
    miniture_host, miniture_port = config.miniture_addr
    miniture_port += 1
    Smith = Agent((miniture_host, miniture_port))

    print Smith.fetch()

Exemplo n.º 3
0
#!/usr/bin/env python

import sys
sys.path.append("../")
import config
from Thinkpol import Agent

miniture_host, miniture_port = config.miniture_addr
miniture_port += 1
Smith = Agent((miniture_host, miniture_port))

info = Smith.fetch()
for worker in info:
    print "%s: %s" % (worker, ", ".join(info[worker]["mods"]))
Exemplo n.º 4
0
#!/usr/bin/env python

import sys;sys.path.append("../")
import config
from Thinkpol import Agent

miniture_host, miniture_port = config.miniture_addr
miniture_port += 1
Smith = Agent((miniture_host, miniture_port))

info = Smith.fetch()
for worker in info:
    print "%s: %s" % (worker, ", ".join(info[worker]["mods"]))