def __init__(self, host, port, version, effective_user=None, use_sasl=False): '''SocketRpcChannel to connect to a socket server on a user defined port. It possible to define version and effective user for the communication.''' self.host = host self.port = port self.sock = None self.call_id = -3 # First time (when the connection context is sent, the call_id should be -3, otherwise start with 0 and increment) self.version = version self.client_id = str(uuid.uuid4()) self.use_sasl = use_sasl if self.use_sasl: if not _kerberos_available: raise Exception( "Kerberos libs not found. Please install snakebite using 'pip install snakebite[kerberos]'" ) kerberos = Kerberos() self.effective_user = effective_user or kerberos.user_principal( ).name else: self.effective_user = effective_user or get_current_username()
def __init__(self, host, port, version, effective_user=None, use_sasl=False): '''SocketRpcChannel to connect to a socket server on a user defined port. It possible to define version and effective user for the communication.''' self.host = host self.port = port self.sock = None self.call_id = -3 # First time (when the connection context is sent, the call_id should be -3, otherwise start with 0 and increment) self.version = version self.client_id = str(uuid.uuid4()) self.use_sasl = use_sasl if self.use_sasl: kerberos = Kerberos() self.effective_user = effective_user or kerberos.user_principal().name else: self.effective_user = effective_user or get_current_username()
def __init__(self, host, port, version, effective_user=None, use_sasl=False, hdfs_namenode_principal=None): '''SocketRpcChannel to connect to a socket server on a user defined port. It possible to define version and effective user for the communication.''' self.host = host self.port = port self.sock = None self.call_id = -3 # First time (when the connection context is sent, the call_id should be -3, otherwise start with 0 and increment) self.version = version self.client_id = str(uuid.uuid4()) self.use_sasl = use_sasl self.hdfs_namenode_principal = hdfs_namenode_principal if self.use_sasl: if not _kerberos_available: raise FatalException("Kerberos libs not found. Please install snakebite using 'pip install snakebite[kerberos]'") kerberos = Kerberos() self.effective_user = effective_user or kerberos.user_principal().name else: self.effective_user = effective_user or get_current_username()