Exemplo n.º 1
0
    def call(self, method, *args, **kwargs):
        key = Group.hash_key(method, *args, **kwargs)
        if key in self._futures:
            return self._futures[key]

        future = concurrent.TracebackFuture()

        msg = json.dumps({
            'key': key,
            'method': method,
            'args': list(args),
            'kwargs': kwargs
        }) + '\r\n'
        self._stream.write(msg)
        self._futures[key] = future
        self._ensure_reading()
        return future
Exemplo n.º 2
0
 def call(self, method, *args, **kwargs):
     key = Group.hash_key(method, *args, **kwargs)
     msg = json.dumps({"key": key, "method": method, "args": args, "kwargs": kwargs}) + "\r\n"
     self._socket.send(msg)
     return self.recv_data()