Esempio n. 1
0
class Cloud(object):
    def __init__(self, f):
        self.f = f
        self.put_client = Client(config.host, "Briareus", pickler=Husky, serialize=True, interval=0.01)
        self.get_client = Client(config.host, "Briareus", pickler=Husky, serialize=False)
        # self.client = Client(config.host, "Briareus", pickler=Husky, serialize=True, interval=0.01)

    def __call__(self, *args):
        key = self.put_client.put_task("eval", (self.f, args))
        return self.get_client.get_result(key, block=True)
        # return Client(config.host, "Briareus", pickler=Husky, serialize=False).eval(self.f, args)
        # return self.client.eval(self.f, args)

    def __getstate__(self):
        return Husky.dumps(self.f)

    def __setstate__(self, state):
        self.f = Husky.loads(state) 
Esempio n. 2
0
 def __init__(self, f):
     self.f = f
     self.put_client = Client(config.host, "Briareus", pickler=Husky, serialize=True, interval=0.01)
     self.get_client = Client(config.host, "Briareus", pickler=Husky, serialize=False)