ImpalaHiveServer2Service.py 14 KB

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