ImpalaHiveServer2Service.py 13 KB

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