# # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # from thrift.Thrift import * from ttypes import * from thrift.Thrift import TProcessor from thrift.transport import TTransport from thrift.protocol import TBinaryProtocol, TProtocol try: from thrift.protocol import fastbinary except: fastbinary = None class Iface(object): def submit(self, plan): """ Parameters: - plan """ pass def get_job_data(self, handle): """ Parameters: - handle """ pass class Client(Iface): def __init__(self, iprot, oprot=None): self._iprot = self._oprot = iprot if oprot != None: self._oprot = oprot self._seqid = 0 def submit(self, plan): """ Parameters: - plan """ self.send_submit(plan) return self.recv_submit() def send_submit(self, plan): self._oprot.writeMessageBegin('submit', TMessageType.CALL, self._seqid) args = submit_args() args.plan = plan args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_submit(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = submit_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success if result.error != None: raise result.error raise TApplicationException(TApplicationException.MISSING_RESULT, "submit failed: unknown result"); def get_job_data(self, handle): """ Parameters: - handle """ self.send_get_job_data(handle) return self.recv_get_job_data() def send_get_job_data(self, handle): self._oprot.writeMessageBegin('get_job_data', TMessageType.CALL, self._seqid) args = get_job_data_args() args.handle = handle args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() def recv_get_job_data(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x result = get_job_data_result() result.read(self._iprot) self._iprot.readMessageEnd() if result.success != None: return result.success if result.error != None: raise result.error raise TApplicationException(TApplicationException.MISSING_RESULT, "get_job_data failed: unknown result"); class Processor(Iface, TProcessor): def __init__(self, handler): self._handler = handler self._processMap = {} self._processMap["submit"] = Processor.process_submit self._processMap["get_job_data"] = Processor.process_get_job_data def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() if name not in self._processMap: iprot.skip(TType.STRUCT) iprot.readMessageEnd() x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name)) oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid) x.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() return else: self._processMap[name](self, seqid, iprot, oprot) return True def process_submit(self, seqid, iprot, oprot): args = submit_args() args.read(iprot) iprot.readMessageEnd() result = submit_result() try: result.success = self._handler.submit(args.plan) except SubmissionError, error: result.error = error oprot.writeMessageBegin("submit", TMessageType.REPLY, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() def process_get_job_data(self, seqid, iprot, oprot): args = get_job_data_args() args.read(iprot) iprot.readMessageEnd() result = get_job_data_result() try: result.success = self._handler.get_job_data(args.handle) except SubmissionError, error: result.error = error oprot.writeMessageBegin("get_job_data", TMessageType.REPLY, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() # HELPER FUNCTIONS AND STRUCTURES class submit_args(object): """ Attributes: - plan """ thrift_spec = ( None, # 0 (1, TType.STRUCT, 'plan', (SubmissionPlan, SubmissionPlan.thrift_spec), None, ), # 1 ) def __init__(self, plan=None,): self.plan = plan 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.STRUCT: self.plan = SubmissionPlan() self.plan.read(iprot) 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('submit_args') if self.plan != None: oprot.writeFieldBegin('plan', TType.STRUCT, 1) self.plan.write(oprot) 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 submit_result(object): """ Attributes: - success - error """ thrift_spec = ( (0, TType.STRUCT, 'success', (SubmissionHandle, SubmissionHandle.thrift_spec), None, ), # 0 (1, TType.STRUCT, 'error', (SubmissionError, SubmissionError.thrift_spec), None, ), # 1 ) def __init__(self, success=None, error=None,): self.success = success self.error = error 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 == 0: if ftype == TType.STRUCT: self.success = SubmissionHandle() self.success.read(iprot) else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: self.error = SubmissionError() self.error.read(iprot) 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('submit_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) oprot.writeFieldEnd() if self.error != None: oprot.writeFieldBegin('error', TType.STRUCT, 1) self.error.write(oprot) 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 get_job_data_args(object): """ Attributes: - handle """ thrift_spec = ( None, # 0 (1, TType.STRUCT, 'handle', (SubmissionHandle, SubmissionHandle.thrift_spec), None, ), # 1 ) def __init__(self, handle=None,): self.handle = handle 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.STRUCT: self.handle = SubmissionHandle() self.handle.read(iprot) 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('get_job_data_args') if self.handle != None: oprot.writeFieldBegin('handle', TType.STRUCT, 1) self.handle.write(oprot) 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 get_job_data_result(object): """ Attributes: - success - error """ thrift_spec = ( (0, TType.STRUCT, 'success', (JobData, JobData.thrift_spec), None, ), # 0 (1, TType.STRUCT, 'error', (SubmissionError, SubmissionError.thrift_spec), None, ), # 1 ) def __init__(self, success=None, error=None,): self.success = success self.error = error 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 == 0: if ftype == TType.STRUCT: self.success = JobData() self.success.read(iprot) else: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: self.error = SubmissionError() self.error.read(iprot) 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('get_job_data_result') if self.success != None: oprot.writeFieldBegin('success', TType.STRUCT, 0) self.success.write(oprot) oprot.writeFieldEnd() if self.error != None: oprot.writeFieldBegin('error', TType.STRUCT, 1) self.error.write(oprot) 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)