Source

hiver / hiver / hive_service / ttypes.py

#
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

from thrift.Thrift import *
from ..fb303 import ttypes as fb303_ttypes
from ..hive_metastore import ttypes as ms_ttypes
from ..queryplan import ttypes as qp_ttypes


from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class JobTrackerState:
  INITIALIZING = 1
  RUNNING = 2

  _VALUES_TO_NAMES = {
    1: "INITIALIZING",
    2: "RUNNING",
  }

  _NAMES_TO_VALUES = {
    "INITIALIZING": 1,
    "RUNNING": 2,
  }


class HiveClusterStatus:
  """
  Attributes:
   - taskTrackers
   - mapTasks
   - reduceTasks
   - maxMapTasks
   - maxReduceTasks
   - state
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'taskTrackers', None, None, ), # 1
    (2, TType.I32, 'mapTasks', None, None, ), # 2
    (3, TType.I32, 'reduceTasks', None, None, ), # 3
    (4, TType.I32, 'maxMapTasks', None, None, ), # 4
    (5, TType.I32, 'maxReduceTasks', None, None, ), # 5
    (6, TType.I32, 'state', None, None, ), # 6
  )

  def __init__(self, taskTrackers=None, mapTasks=None, reduceTasks=None, maxMapTasks=None, maxReduceTasks=None, state=None,):
    self.taskTrackers = taskTrackers
    self.mapTasks = mapTasks
    self.reduceTasks = reduceTasks
    self.maxMapTasks = maxMapTasks
    self.maxReduceTasks = maxReduceTasks
    self.state = state

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.taskTrackers = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.mapTasks = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.reduceTasks = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I32:
          self.maxMapTasks = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.I32:
          self.maxReduceTasks = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I32:
          self.state = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('HiveClusterStatus')
    if self.taskTrackers is not None:
      oprot.writeFieldBegin('taskTrackers', TType.I32, 1)
      oprot.writeI32(self.taskTrackers)
      oprot.writeFieldEnd()
    if self.mapTasks is not None:
      oprot.writeFieldBegin('mapTasks', TType.I32, 2)
      oprot.writeI32(self.mapTasks)
      oprot.writeFieldEnd()
    if self.reduceTasks is not None:
      oprot.writeFieldBegin('reduceTasks', TType.I32, 3)
      oprot.writeI32(self.reduceTasks)
      oprot.writeFieldEnd()
    if self.maxMapTasks is not None:
      oprot.writeFieldBegin('maxMapTasks', TType.I32, 4)
      oprot.writeI32(self.maxMapTasks)
      oprot.writeFieldEnd()
    if self.maxReduceTasks is not None:
      oprot.writeFieldBegin('maxReduceTasks', TType.I32, 5)
      oprot.writeI32(self.maxReduceTasks)
      oprot.writeFieldEnd()
    if self.state is not None:
      oprot.writeFieldBegin('state', TType.I32, 6)
      oprot.writeI32(self.state)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class HiveServerException(Exception):
  """
  Attributes:
   - message
   - errorCode
   - SQLState
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'message', None, None, ), # 1
    (2, TType.I32, 'errorCode', None, None, ), # 2
    (3, TType.STRING, 'SQLState', None, None, ), # 3
  )

  def __init__(self, message=None, errorCode=None, SQLState=None,):
    self.message = message
    self.errorCode = errorCode
    self.SQLState = SQLState

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.errorCode = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.SQLState = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('HiveServerException')
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 1)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    if self.errorCode is not None:
      oprot.writeFieldBegin('errorCode', TType.I32, 2)
      oprot.writeI32(self.errorCode)
      oprot.writeFieldEnd()
    if self.SQLState is not None:
      oprot.writeFieldBegin('SQLState', TType.STRING, 3)
      oprot.writeString(self.SQLState)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)