Exemplo n.º 1
0
    def __init__(self,
                 service_stub_class,
                 port,
                 host,
                 hadoop_version,
                 effective_user=None,
                 use_sasl=False,
                 hdfs_namenode_principal=None):
        self.service_stub_class = service_stub_class
        self.port = port
        self.host = host

        # Setup the RPC channel
        self.channel = SocketRpcChannel(
            host=self.host,
            port=self.port,
            version=hadoop_version,
            effective_user=effective_user,
            use_sasl=use_sasl,
            hdfs_namenode_principal=hdfs_namenode_principal)
        self.service = self.service_stub_class(self.channel)

        # go through service_stub methods and add a wrapper function to
        # this object that will call the method
        for method in service_stub_class.GetDescriptor().methods:
            # Add service methods to the this object
            rpc = lambda request, service=self, method=method.name: service.call(
                service_stub_class.__dict__[method], request)

            self.__dict__[method.name] = rpc
Exemplo n.º 2
0
    def __init__(self,
                 service_stub_class,
                 context_proto,
                 port,
                 host,
                 hadoop_version,
                 timeout=30):
        self.service_stub_class = service_stub_class
        self.port = port
        self.host = host

        # Setup the RPC channel
        self.channel = SocketRpcChannel(host=self.host,
                                        port=self.port,
                                        version=hadoop_version,
                                        context_protocol=context_proto,
                                        timeout=timeout)
        self.service = self.service_stub_class(self.channel)

        # go through service_stub methods and add a wrapper function to
        # this object that will call the method
        for method in service_stub_class.GetDescriptor().methods:
            # Add service methods to the this object
            rpc = lambda request, service=self, method=method.name: service.call(
                service_stub_class.__dict__[method], request)

            self.__dict__[method.name] = rpc
Exemplo n.º 3
0
    def __init__(self, service_stub_class, port, host, hadoop_version, effective_user=None,use_sasl=False):
        self.service_stub_class = service_stub_class
        self.port = port
        self.host = host

        # Setup the RPC channel
        self.channel = SocketRpcChannel(host=self.host, port=self.port, version=hadoop_version, effective_user=effective_user,use_sasl=use_sasl)
        self.service = self.service_stub_class(self.channel)

        # go through service_stub methods and add a wrapper function to
        # this object that will call the method
        for method in service_stub_class.GetDescriptor().methods:
            # Add service methods to the this object
            rpc = lambda request, service=self, method=method.name: service.call(service_stub_class.__dict__[method], request)

            self.__dict__[method.name] = rpc
Exemplo n.º 4
0
    def __init__(self, service_stub_class, context_proto, port, host, hadoop_version, timeout=30):
        self.service_stub_class = service_stub_class
        self.port = port
        self.host = host

        # Setup the RPC channel
        self.channel = SocketRpcChannel(host=self.host, port=self.port, version=hadoop_version, context_protocol=context_proto, timeout=timeout)
        self.service = self.service_stub_class(self.channel)

        # go through service_stub methods and add a wrapper function to
        # this object that will call the method
        for method in service_stub_class.GetDescriptor().methods:
            # Add service methods to the this object
            rpc = lambda request, service=self, method=method.name: service.call(service_stub_class.__dict__[method], request)

            self.__dict__[method.name] = rpc