ImpalaHiveServer2Service.py 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. from __future__ import absolute_import
  2. #
  3. # Autogenerated by Thrift Compiler (0.9.3)
  4. #
  5. # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  6. #
  7. # options string: py:new_style
  8. #
  9. from builtins import object
  10. from thrift.Thrift import TType, TMessageType, TException, TApplicationException
  11. import TCLIService.TCLIService
  12. import logging
  13. from ImpalaService.ttypes import *
  14. from thrift.Thrift import TProcessor
  15. from thrift.transport import TTransport
  16. from thrift.protocol import TBinaryProtocol, TProtocol
  17. try:
  18. from thrift.protocol import fastbinary
  19. except:
  20. fastbinary = None
  21. class Iface(TCLIService.TCLIService.Iface):
  22. def GetExecSummary(self, req):
  23. """
  24. Parameters:
  25. - req
  26. """
  27. pass
  28. def GetRuntimeProfile(self, req):
  29. """
  30. Parameters:
  31. - req
  32. """
  33. pass
  34. class Client(TCLIService.TCLIService.Client, Iface):
  35. def __init__(self, iprot, oprot=None):
  36. TCLIService.TCLIService.Client.__init__(self, iprot, oprot)
  37. def GetExecSummary(self, req):
  38. """
  39. Parameters:
  40. - req
  41. """
  42. self.send_GetExecSummary(req)
  43. return self.recv_GetExecSummary()
  44. def send_GetExecSummary(self, req):
  45. self._oprot.writeMessageBegin('GetExecSummary', TMessageType.CALL, self._seqid)
  46. args = GetExecSummary_args()
  47. args.req = req
  48. args.write(self._oprot)
  49. self._oprot.writeMessageEnd()
  50. self._oprot.trans.flush()
  51. def recv_GetExecSummary(self):
  52. iprot = self._iprot
  53. (fname, mtype, rseqid) = iprot.readMessageBegin()
  54. if mtype == TMessageType.EXCEPTION:
  55. x = TApplicationException()
  56. x.read(iprot)
  57. iprot.readMessageEnd()
  58. raise x
  59. result = GetExecSummary_result()
  60. result.read(iprot)
  61. iprot.readMessageEnd()
  62. if result.success is not None:
  63. return result.success
  64. raise TApplicationException(TApplicationException.MISSING_RESULT, "GetExecSummary failed: unknown result")
  65. def GetRuntimeProfile(self, req):
  66. """
  67. Parameters:
  68. - req
  69. """
  70. self.send_GetRuntimeProfile(req)
  71. return self.recv_GetRuntimeProfile()
  72. def send_GetRuntimeProfile(self, req):
  73. self._oprot.writeMessageBegin('GetRuntimeProfile', TMessageType.CALL, self._seqid)
  74. args = GetRuntimeProfile_args()
  75. args.req = req
  76. args.write(self._oprot)
  77. self._oprot.writeMessageEnd()
  78. self._oprot.trans.flush()
  79. def recv_GetRuntimeProfile(self):
  80. iprot = self._iprot
  81. (fname, mtype, rseqid) = iprot.readMessageBegin()
  82. if mtype == TMessageType.EXCEPTION:
  83. x = TApplicationException()
  84. x.read(iprot)
  85. iprot.readMessageEnd()
  86. raise x
  87. result = GetRuntimeProfile_result()
  88. result.read(iprot)
  89. iprot.readMessageEnd()
  90. if result.success is not None:
  91. return result.success
  92. raise TApplicationException(TApplicationException.MISSING_RESULT, "GetRuntimeProfile failed: unknown result")
  93. class Processor(TCLIService.TCLIService.Processor, Iface, TProcessor):
  94. def __init__(self, handler):
  95. TCLIService.TCLIService.Processor.__init__(self, handler)
  96. self._processMap["GetExecSummary"] = Processor.process_GetExecSummary
  97. self._processMap["GetRuntimeProfile"] = Processor.process_GetRuntimeProfile
  98. def process(self, iprot, oprot):
  99. (name, type, seqid) = iprot.readMessageBegin()
  100. if name not in self._processMap:
  101. iprot.skip(TType.STRUCT)
  102. iprot.readMessageEnd()
  103. x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
  104. oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
  105. x.write(oprot)
  106. oprot.writeMessageEnd()
  107. oprot.trans.flush()
  108. return
  109. else:
  110. self._processMap[name](self, seqid, iprot, oprot)
  111. return True
  112. def process_GetExecSummary(self, seqid, iprot, oprot):
  113. args = GetExecSummary_args()
  114. args.read(iprot)
  115. iprot.readMessageEnd()
  116. result = GetExecSummary_result()
  117. try:
  118. result.success = self._handler.GetExecSummary(args.req)
  119. msg_type = TMessageType.REPLY
  120. except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
  121. raise
  122. except Exception as ex:
  123. msg_type = TMessageType.EXCEPTION
  124. logging.exception(ex)
  125. result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
  126. oprot.writeMessageBegin("GetExecSummary", msg_type, seqid)
  127. result.write(oprot)
  128. oprot.writeMessageEnd()
  129. oprot.trans.flush()
  130. def process_GetRuntimeProfile(self, seqid, iprot, oprot):
  131. args = GetRuntimeProfile_args()
  132. args.read(iprot)
  133. iprot.readMessageEnd()
  134. result = GetRuntimeProfile_result()
  135. try:
  136. result.success = self._handler.GetRuntimeProfile(args.req)
  137. msg_type = TMessageType.REPLY
  138. except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
  139. raise
  140. except Exception as ex:
  141. msg_type = TMessageType.EXCEPTION
  142. logging.exception(ex)
  143. result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
  144. oprot.writeMessageBegin("GetRuntimeProfile", msg_type, seqid)
  145. result.write(oprot)
  146. oprot.writeMessageEnd()
  147. oprot.trans.flush()
  148. # HELPER FUNCTIONS AND STRUCTURES
  149. class GetExecSummary_args(object):
  150. """
  151. Attributes:
  152. - req
  153. """
  154. thrift_spec = (
  155. None, # 0
  156. (1, TType.STRUCT, 'req', (TGetExecSummaryReq, TGetExecSummaryReq.thrift_spec), None, ), # 1
  157. )
  158. def __init__(self, req=None,):
  159. self.req = req
  160. def read(self, iprot):
  161. if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
  162. fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
  163. return
  164. iprot.readStructBegin()
  165. while True:
  166. (fname, ftype, fid) = iprot.readFieldBegin()
  167. if ftype == TType.STOP:
  168. break
  169. if fid == 1:
  170. if ftype == TType.STRUCT:
  171. self.req = TGetExecSummaryReq()
  172. self.req.read(iprot)
  173. else:
  174. iprot.skip(ftype)
  175. else:
  176. iprot.skip(ftype)
  177. iprot.readFieldEnd()
  178. iprot.readStructEnd()
  179. def write(self, oprot):
  180. if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
  181. oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
  182. return
  183. oprot.writeStructBegin('GetExecSummary_args')
  184. if self.req is not None:
  185. oprot.writeFieldBegin('req', TType.STRUCT, 1)
  186. self.req.write(oprot)
  187. oprot.writeFieldEnd()
  188. oprot.writeFieldStop()
  189. oprot.writeStructEnd()
  190. def validate(self):
  191. return
  192. def __hash__(self):
  193. value = 17
  194. value = (value * 31) ^ hash(self.req)
  195. return value
  196. def __repr__(self):
  197. L = ['%s=%r' % (key, value)
  198. for key, value in self.__dict__.items()]
  199. return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  200. def __eq__(self, other):
  201. return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  202. def __ne__(self, other):
  203. return not (self == other)
  204. class GetExecSummary_result(object):
  205. """
  206. Attributes:
  207. - success
  208. """
  209. thrift_spec = (
  210. (0, TType.STRUCT, 'success', (TGetExecSummaryResp, TGetExecSummaryResp.thrift_spec), None, ), # 0
  211. )
  212. def __init__(self, success=None,):
  213. self.success = success
  214. def read(self, iprot):
  215. if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
  216. fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
  217. return
  218. iprot.readStructBegin()
  219. while True:
  220. (fname, ftype, fid) = iprot.readFieldBegin()
  221. if ftype == TType.STOP:
  222. break
  223. if fid == 0:
  224. if ftype == TType.STRUCT:
  225. self.success = TGetExecSummaryResp()
  226. self.success.read(iprot)
  227. else:
  228. iprot.skip(ftype)
  229. else:
  230. iprot.skip(ftype)
  231. iprot.readFieldEnd()
  232. iprot.readStructEnd()
  233. def write(self, oprot):
  234. if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
  235. oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
  236. return
  237. oprot.writeStructBegin('GetExecSummary_result')
  238. if self.success is not None:
  239. oprot.writeFieldBegin('success', TType.STRUCT, 0)
  240. self.success.write(oprot)
  241. oprot.writeFieldEnd()
  242. oprot.writeFieldStop()
  243. oprot.writeStructEnd()
  244. def validate(self):
  245. return
  246. def __hash__(self):
  247. value = 17
  248. value = (value * 31) ^ hash(self.success)
  249. return value
  250. def __repr__(self):
  251. L = ['%s=%r' % (key, value)
  252. for key, value in self.__dict__.items()]
  253. return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  254. def __eq__(self, other):
  255. return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  256. def __ne__(self, other):
  257. return not (self == other)
  258. class GetRuntimeProfile_args(object):
  259. """
  260. Attributes:
  261. - req
  262. """
  263. thrift_spec = (
  264. None, # 0
  265. (1, TType.STRUCT, 'req', (TGetRuntimeProfileReq, TGetRuntimeProfileReq.thrift_spec), None, ), # 1
  266. )
  267. def __init__(self, req=None,):
  268. self.req = req
  269. def read(self, iprot):
  270. if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
  271. fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
  272. return
  273. iprot.readStructBegin()
  274. while True:
  275. (fname, ftype, fid) = iprot.readFieldBegin()
  276. if ftype == TType.STOP:
  277. break
  278. if fid == 1:
  279. if ftype == TType.STRUCT:
  280. self.req = TGetRuntimeProfileReq()
  281. self.req.read(iprot)
  282. else:
  283. iprot.skip(ftype)
  284. else:
  285. iprot.skip(ftype)
  286. iprot.readFieldEnd()
  287. iprot.readStructEnd()
  288. def write(self, oprot):
  289. if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
  290. oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
  291. return
  292. oprot.writeStructBegin('GetRuntimeProfile_args')
  293. if self.req is not None:
  294. oprot.writeFieldBegin('req', TType.STRUCT, 1)
  295. self.req.write(oprot)
  296. oprot.writeFieldEnd()
  297. oprot.writeFieldStop()
  298. oprot.writeStructEnd()
  299. def validate(self):
  300. return
  301. def __hash__(self):
  302. value = 17
  303. value = (value * 31) ^ hash(self.req)
  304. return value
  305. def __repr__(self):
  306. L = ['%s=%r' % (key, value)
  307. for key, value in self.__dict__.items()]
  308. return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  309. def __eq__(self, other):
  310. return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  311. def __ne__(self, other):
  312. return not (self == other)
  313. class GetRuntimeProfile_result(object):
  314. """
  315. Attributes:
  316. - success
  317. """
  318. thrift_spec = (
  319. (0, TType.STRUCT, 'success', (TGetRuntimeProfileResp, TGetRuntimeProfileResp.thrift_spec), None, ), # 0
  320. )
  321. def __init__(self, success=None,):
  322. self.success = success
  323. def read(self, iprot):
  324. if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
  325. fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
  326. return
  327. iprot.readStructBegin()
  328. while True:
  329. (fname, ftype, fid) = iprot.readFieldBegin()
  330. if ftype == TType.STOP:
  331. break
  332. if fid == 0:
  333. if ftype == TType.STRUCT:
  334. self.success = TGetRuntimeProfileResp()
  335. self.success.read(iprot)
  336. else:
  337. iprot.skip(ftype)
  338. else:
  339. iprot.skip(ftype)
  340. iprot.readFieldEnd()
  341. iprot.readStructEnd()
  342. def write(self, oprot):
  343. if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
  344. oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
  345. return
  346. oprot.writeStructBegin('GetRuntimeProfile_result')
  347. if self.success is not None:
  348. oprot.writeFieldBegin('success', TType.STRUCT, 0)
  349. self.success.write(oprot)
  350. oprot.writeFieldEnd()
  351. oprot.writeFieldStop()
  352. oprot.writeStructEnd()
  353. def validate(self):
  354. return
  355. def __hash__(self):
  356. value = 17
  357. value = (value * 31) ^ hash(self.success)
  358. return value
  359. def __repr__(self):
  360. L = ['%s=%r' % (key, value)
  361. for key, value in self.__dict__.items()]
  362. return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
  363. def __eq__(self, other):
  364. return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
  365. def __ne__(self, other):
  366. return not (self == other)