mirror of
https://github.com/apache/impala.git
synced 2025-12-23 21:08:39 -05:00
IMP-690: impala-shell calls PingImpalaService thrift API to verify
the connected server is an impalad.
This commit is contained in:
committed by
Henry Robinson
parent
20f9d46328
commit
ff704ce586
@@ -230,15 +230,23 @@ class ImpalaShell(cmd.Cmd):
|
||||
self.transport.close()
|
||||
self.transport = None
|
||||
|
||||
self.connected = False
|
||||
try:
|
||||
self.transport = self.__get_transport()
|
||||
self.transport.open()
|
||||
protocol = TBinaryProtocol.TBinaryProtocol(self.transport)
|
||||
self.imp_service = ImpalaService.Client(protocol)
|
||||
self.connected = True
|
||||
try:
|
||||
self.imp_service.PingImpalaService()
|
||||
self.connected = True
|
||||
except Exception, e:
|
||||
print ("Error: Unable to communicate with impalad service. This service may not "
|
||||
"be an impalad instance. Check host:port and try again.")
|
||||
self.transport.close()
|
||||
raise
|
||||
except Exception, e:
|
||||
print "Error connecting: %s, %s" % (type(e),e)
|
||||
self.connected = False
|
||||
|
||||
return self.connected
|
||||
|
||||
def __get_transport(self):
|
||||
|
||||
Reference in New Issue
Block a user