http://git-wip-us.apache.org/repos/asf/storm/blob/1fd1e17f/storm-client/src/py/storm/DistributedRPC-remote ---------------------------------------------------------------------- diff --git a/storm-client/src/py/storm/DistributedRPC-remote b/storm-client/src/py/storm/DistributedRPC-remote index 90f894a..913e191 100644 --- a/storm-client/src/py/storm/DistributedRPC-remote +++ b/storm-client/src/py/storm/DistributedRPC-remote @@ -18,7 +18,7 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.9.3) +# Autogenerated by Thrift Compiler (0.11.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -27,86 +27,109 @@ import sys import pprint -from urlparse import urlparse -from thrift.transport import TTransport -from thrift.transport import TSocket -from thrift.transport import TSSLSocket -from thrift.transport import THttpClient -from thrift.protocol import TBinaryProtocol +if sys.version_info[0] > 2: + from urllib.parse import urlparse +else: + from urlparse import urlparse +from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient +from thrift.protocol.TBinaryProtocol import TBinaryProtocol from storm import DistributedRPC from storm.ttypes import * if len(sys.argv) <= 1 or sys.argv[1] == '--help': - print('') - print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]') - print('') - print('Functions:') - print(' string execute(string functionName, string funcArgs)') - print('') - sys.exit(0) - -pp = pprint.PrettyPrinter(indent = 2) + print('') + print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' string execute(string functionName, string funcArgs)') + print('') + sys.exit(0) + +pp = pprint.PrettyPrinter(indent=2) host = 'localhost' port = 9090 uri = '' framed = False ssl = False +validate = True +ca_certs = None +keyfile = None +certfile = None http = False argi = 1 if sys.argv[argi] == '-h': - parts = sys.argv[argi+1].split(':') - host = parts[0] - if len(parts) > 1: - port = int(parts[1]) - argi += 2 + parts = sys.argv[argi + 1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + argi += 2 if sys.argv[argi] == '-u': - url = urlparse(sys.argv[argi+1]) - parts = url[1].split(':') - host = parts[0] - if len(parts) > 1: - port = int(parts[1]) - else: - port = 80 - uri = url[2] - if url[4]: - uri += '?%s' % url[4] - http = True - argi += 2 + url = urlparse(sys.argv[argi + 1]) + parts = url[1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + else: + port = 80 + uri = url[2] + if url[4]: + uri += '?%s' % url[4] + http = True + argi += 2 if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': - framed = True - argi += 1 + framed = True + argi += 1 if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': - ssl = True - argi += 1 + ssl = True + argi += 1 + +if sys.argv[argi] == '-novalidate': + validate = False + argi += 1 + +if sys.argv[argi] == '-ca_certs': + ca_certs = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-keyfile': + keyfile = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-certfile': + certfile = sys.argv[argi+1] + argi += 2 cmd = sys.argv[argi] -args = sys.argv[argi+1:] +args = sys.argv[argi + 1:] if http: - transport = THttpClient.THttpClient(host, port, uri) + transport = THttpClient.THttpClient(host, port, uri) else: - socket = TSSLSocket.TSSLSocket(host, port, validate=False) if ssl else TSocket.TSocket(host, port) - if framed: - transport = TTransport.TFramedTransport(socket) - else: - transport = TTransport.TBufferedTransport(socket) -protocol = TBinaryProtocol.TBinaryProtocol(transport) + if ssl: + socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile) + else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol(transport) client = DistributedRPC.Client(protocol) transport.open() if cmd == 'execute': - if len(args) != 2: - print('execute requires 2 args') - sys.exit(1) - pp.pprint(client.execute(args[0],args[1],)) + if len(args) != 2: + print('execute requires 2 args') + sys.exit(1) + pp.pprint(client.execute(args[0], args[1],)) else: - print('Unrecognized method %s' % cmd) - sys.exit(1) + print('Unrecognized method %s' % cmd) + sys.exit(1) transport.close()
http://git-wip-us.apache.org/repos/asf/storm/blob/1fd1e17f/storm-client/src/py/storm/DistributedRPC.py ---------------------------------------------------------------------- diff --git a/storm-client/src/py/storm/DistributedRPC.py b/storm-client/src/py/storm/DistributedRPC.py index 225c57e..8bda692 100644 --- a/storm-client/src/py/storm/DistributedRPC.py +++ b/storm-client/src/py/storm/DistributedRPC.py @@ -17,295 +17,290 @@ # limitations under the License. # -# Autogenerated by Thrift Compiler (0.9.3) +# Autogenerated by Thrift Compiler (0.11.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py:utf8strings # -from thrift.Thrift import TType, TMessageType, TException, TApplicationException +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + +import sys import logging -from ttypes 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 +all_structs = [] -class Iface: - def execute(self, functionName, funcArgs): - """ - Parameters: - - functionName - - funcArgs - """ - pass +class Iface(object): + def execute(self, functionName, funcArgs): + """ + Parameters: + - functionName + - funcArgs + """ + pass class Client(Iface): - def __init__(self, iprot, oprot=None): - self._iprot = self._oprot = iprot - if oprot is not None: - self._oprot = oprot - self._seqid = 0 + def __init__(self, iprot, oprot=None): + self._iprot = self._oprot = iprot + if oprot is not None: + self._oprot = oprot + self._seqid = 0 + + def execute(self, functionName, funcArgs): + """ + Parameters: + - functionName + - funcArgs + """ + self.send_execute(functionName, funcArgs) + return self.recv_execute() + + def send_execute(self, functionName, funcArgs): + self._oprot.writeMessageBegin('execute', TMessageType.CALL, self._seqid) + args = execute_args() + args.functionName = functionName + args.funcArgs = funcArgs + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_execute(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = execute_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.e is not None: + raise result.e + if result.aze is not None: + raise result.aze + raise TApplicationException(TApplicationException.MISSING_RESULT, "execute failed: unknown result") + + +class Processor(Iface, TProcessor): + def __init__(self, handler): + self._handler = handler + self._processMap = {} + self._processMap["execute"] = Processor.process_execute + + 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_execute(self, seqid, iprot, oprot): + args = execute_args() + args.read(iprot) + iprot.readMessageEnd() + result = execute_result() + try: + result.success = self._handler.execute(args.functionName, args.funcArgs) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except DRPCExecutionException as e: + msg_type = TMessageType.REPLY + result.e = e + except AuthorizationException as aze: + msg_type = TMessageType.REPLY + result.aze = aze + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("execute", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + +# HELPER FUNCTIONS AND STRUCTURES - def execute(self, functionName, funcArgs): + +class execute_args(object): """ - Parameters: + Attributes: - functionName - funcArgs """ - self.send_execute(functionName, funcArgs) - return self.recv_execute() - - def send_execute(self, functionName, funcArgs): - self._oprot.writeMessageBegin('execute', TMessageType.CALL, self._seqid) - args = execute_args() - args.functionName = functionName - args.funcArgs = funcArgs - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_execute(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = execute_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.e is not None: - raise result.e - if result.aze is not None: - raise result.aze - raise TApplicationException(TApplicationException.MISSING_RESULT, "execute failed: unknown result") -class Processor(Iface, TProcessor): - def __init__(self, handler): - self._handler = handler - self._processMap = {} - self._processMap["execute"] = Processor.process_execute - - 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_execute(self, seqid, iprot, oprot): - args = execute_args() - args.read(iprot) - iprot.readMessageEnd() - result = execute_result() - try: - result.success = self._handler.execute(args.functionName, args.funcArgs) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except DRPCExecutionException as e: - msg_type = TMessageType.REPLY - result.e = e - except AuthorizationException as aze: - msg_type = TMessageType.REPLY - result.aze = aze - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("execute", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def __init__(self, functionName=None, funcArgs=None,): + self.functionName = functionName + self.funcArgs = funcArgs + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.functionName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.funcArgs = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('execute_args') + if self.functionName is not None: + oprot.writeFieldBegin('functionName', TType.STRING, 1) + oprot.writeString(self.functionName.encode('utf-8') if sys.version_info[0] == 2 else self.functionName) + oprot.writeFieldEnd() + if self.funcArgs is not None: + oprot.writeFieldBegin('funcArgs', TType.STRING, 2) + oprot.writeString(self.funcArgs.encode('utf-8') if sys.version_info[0] == 2 else self.funcArgs) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + 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) +all_structs.append(execute_args) +execute_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'functionName', 'UTF8', None, ), # 1 + (2, TType.STRING, 'funcArgs', 'UTF8', None, ), # 2 +) + + +class execute_result(object): + """ + Attributes: + - success + - e + - aze + """ -# HELPER FUNCTIONS AND STRUCTURES + def __init__(self, success=None, e=None, aze=None,): + self.success = success + self.e = e + self.aze = aze + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.STRING: + self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.e = DRPCExecutionException() + self.e.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.aze = AuthorizationException() + self.aze.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('execute_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldEnd() + if self.e is not None: + oprot.writeFieldBegin('e', TType.STRUCT, 1) + self.e.write(oprot) + oprot.writeFieldEnd() + if self.aze is not None: + oprot.writeFieldBegin('aze', TType.STRUCT, 2) + self.aze.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__.items()] + 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) +all_structs.append(execute_result) +execute_result.thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'e', [DRPCExecutionException, None], None, ), # 1 + (2, TType.STRUCT, 'aze', [AuthorizationException, None], None, ), # 2 +) +fix_spec(all_structs) +del all_structs -class execute_args: - """ - Attributes: - - functionName - - funcArgs - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'functionName', None, None, ), # 1 - (2, TType.STRING, 'funcArgs', None, None, ), # 2 - ) - - def __init__(self, functionName=None, funcArgs=None,): - self.functionName = functionName - self.funcArgs = funcArgs - - 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.functionName = iprot.readString().decode('utf-8') - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRING: - self.funcArgs = iprot.readString().decode('utf-8') - 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('execute_args') - if self.functionName is not None: - oprot.writeFieldBegin('functionName', TType.STRING, 1) - oprot.writeString(self.functionName.encode('utf-8')) - oprot.writeFieldEnd() - if self.funcArgs is not None: - oprot.writeFieldBegin('funcArgs', TType.STRING, 2) - oprot.writeString(self.funcArgs.encode('utf-8')) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.functionName) - value = (value * 31) ^ hash(self.funcArgs) - return value - - 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 execute_result: - """ - Attributes: - - success - - e - - aze - """ - - thrift_spec = ( - (0, TType.STRING, 'success', None, None, ), # 0 - (1, TType.STRUCT, 'e', (DRPCExecutionException, DRPCExecutionException.thrift_spec), None, ), # 1 - (2, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 2 - ) - - def __init__(self, success=None, e=None, aze=None,): - self.success = success - self.e = e - self.aze = aze - - 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.STRING: - self.success = iprot.readString().decode('utf-8') - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.e = DRPCExecutionException() - self.e.read(iprot) - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.aze = AuthorizationException() - self.aze.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('execute_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRING, 0) - oprot.writeString(self.success.encode('utf-8')) - oprot.writeFieldEnd() - if self.e is not None: - oprot.writeFieldBegin('e', TType.STRUCT, 1) - self.e.write(oprot) - oprot.writeFieldEnd() - if self.aze is not None: - oprot.writeFieldBegin('aze', TType.STRUCT, 2) - self.aze.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.success) - value = (value * 31) ^ hash(self.e) - value = (value * 31) ^ hash(self.aze) - return value - - 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) http://git-wip-us.apache.org/repos/asf/storm/blob/1fd1e17f/storm-client/src/py/storm/DistributedRPCInvocations-remote ---------------------------------------------------------------------- diff --git a/storm-client/src/py/storm/DistributedRPCInvocations-remote b/storm-client/src/py/storm/DistributedRPCInvocations-remote index d1f100e..16e904d 100644 --- a/storm-client/src/py/storm/DistributedRPCInvocations-remote +++ b/storm-client/src/py/storm/DistributedRPCInvocations-remote @@ -18,7 +18,7 @@ #!/usr/bin/env python # -# Autogenerated by Thrift Compiler (0.9.3) +# Autogenerated by Thrift Compiler (0.11.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # @@ -27,107 +27,130 @@ import sys import pprint -from urlparse import urlparse -from thrift.transport import TTransport -from thrift.transport import TSocket -from thrift.transport import TSSLSocket -from thrift.transport import THttpClient -from thrift.protocol import TBinaryProtocol +if sys.version_info[0] > 2: + from urllib.parse import urlparse +else: + from urlparse import urlparse +from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient +from thrift.protocol.TBinaryProtocol import TBinaryProtocol from storm import DistributedRPCInvocations from storm.ttypes import * if len(sys.argv) <= 1 or sys.argv[1] == '--help': - print('') - print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]') - print('') - print('Functions:') - print(' void result(string id, string result)') - print(' DRPCRequest fetchRequest(string functionName)') - print(' void failRequest(string id)') - print(' void failRequestV2(string id, DRPCExecutionException e)') - print('') - sys.exit(0) - -pp = pprint.PrettyPrinter(indent = 2) + print('') + print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') + print('') + print('Functions:') + print(' void result(string id, string result)') + print(' DRPCRequest fetchRequest(string functionName)') + print(' void failRequest(string id)') + print(' void failRequestV2(string id, DRPCExecutionException e)') + print('') + sys.exit(0) + +pp = pprint.PrettyPrinter(indent=2) host = 'localhost' port = 9090 uri = '' framed = False ssl = False +validate = True +ca_certs = None +keyfile = None +certfile = None http = False argi = 1 if sys.argv[argi] == '-h': - parts = sys.argv[argi+1].split(':') - host = parts[0] - if len(parts) > 1: - port = int(parts[1]) - argi += 2 + parts = sys.argv[argi + 1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + argi += 2 if sys.argv[argi] == '-u': - url = urlparse(sys.argv[argi+1]) - parts = url[1].split(':') - host = parts[0] - if len(parts) > 1: - port = int(parts[1]) - else: - port = 80 - uri = url[2] - if url[4]: - uri += '?%s' % url[4] - http = True - argi += 2 + url = urlparse(sys.argv[argi + 1]) + parts = url[1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + else: + port = 80 + uri = url[2] + if url[4]: + uri += '?%s' % url[4] + http = True + argi += 2 if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': - framed = True - argi += 1 + framed = True + argi += 1 if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': - ssl = True - argi += 1 + ssl = True + argi += 1 + +if sys.argv[argi] == '-novalidate': + validate = False + argi += 1 + +if sys.argv[argi] == '-ca_certs': + ca_certs = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-keyfile': + keyfile = sys.argv[argi+1] + argi += 2 + +if sys.argv[argi] == '-certfile': + certfile = sys.argv[argi+1] + argi += 2 cmd = sys.argv[argi] -args = sys.argv[argi+1:] +args = sys.argv[argi + 1:] if http: - transport = THttpClient.THttpClient(host, port, uri) + transport = THttpClient.THttpClient(host, port, uri) else: - socket = TSSLSocket.TSSLSocket(host, port, validate=False) if ssl else TSocket.TSocket(host, port) - if framed: - transport = TTransport.TFramedTransport(socket) - else: - transport = TTransport.TBufferedTransport(socket) -protocol = TBinaryProtocol.TBinaryProtocol(transport) + if ssl: + socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile) + else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol(transport) client = DistributedRPCInvocations.Client(protocol) transport.open() if cmd == 'result': - if len(args) != 2: - print('result requires 2 args') - sys.exit(1) - pp.pprint(client.result(args[0],args[1],)) + if len(args) != 2: + print('result requires 2 args') + sys.exit(1) + pp.pprint(client.result(args[0], args[1],)) elif cmd == 'fetchRequest': - if len(args) != 1: - print('fetchRequest requires 1 args') - sys.exit(1) - pp.pprint(client.fetchRequest(args[0],)) + if len(args) != 1: + print('fetchRequest requires 1 args') + sys.exit(1) + pp.pprint(client.fetchRequest(args[0],)) elif cmd == 'failRequest': - if len(args) != 1: - print('failRequest requires 1 args') - sys.exit(1) - pp.pprint(client.failRequest(args[0],)) + if len(args) != 1: + print('failRequest requires 1 args') + sys.exit(1) + pp.pprint(client.failRequest(args[0],)) elif cmd == 'failRequestV2': - if len(args) != 2: - print('failRequestV2 requires 2 args') - sys.exit(1) - pp.pprint(client.failRequestV2(args[0],eval(args[1]),)) + if len(args) != 2: + print('failRequestV2 requires 2 args') + sys.exit(1) + pp.pprint(client.failRequestV2(args[0], eval(args[1]),)) else: - print('Unrecognized method %s' % cmd) - sys.exit(1) + print('Unrecognized method %s' % cmd) + sys.exit(1) transport.close() http://git-wip-us.apache.org/repos/asf/storm/blob/1fd1e17f/storm-client/src/py/storm/DistributedRPCInvocations.py ---------------------------------------------------------------------- diff --git a/storm-client/src/py/storm/DistributedRPCInvocations.py b/storm-client/src/py/storm/DistributedRPCInvocations.py index df873fe..d231727 100644 --- a/storm-client/src/py/storm/DistributedRPCInvocations.py +++ b/storm-client/src/py/storm/DistributedRPCInvocations.py @@ -17,870 +17,853 @@ # limitations under the License. # -# Autogenerated by Thrift Compiler (0.9.3) +# Autogenerated by Thrift Compiler (0.11.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py:utf8strings # -from thrift.Thrift import TType, TMessageType, TException, TApplicationException +from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException +from thrift.protocol.TProtocol import TProtocolException +from thrift.TRecursive import fix_spec + +import sys import logging -from ttypes 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 +all_structs = [] + + +class Iface(object): + def result(self, id, result): + """ + Parameters: + - id + - result + """ + pass + + def fetchRequest(self, functionName): + """ + Parameters: + - functionName + """ + pass + + def failRequest(self, id): + """ + Parameters: + - id + """ + pass + + def failRequestV2(self, id, e): + """ + Parameters: + - id + - e + """ + pass + + +class Client(Iface): + def __init__(self, iprot, oprot=None): + self._iprot = self._oprot = iprot + if oprot is not None: + self._oprot = oprot + self._seqid = 0 + + def result(self, id, result): + """ + Parameters: + - id + - result + """ + self.send_result(id, result) + self.recv_result() + + def send_result(self, id, result): + self._oprot.writeMessageBegin('result', TMessageType.CALL, self._seqid) + args = result_args() + args.id = id + args.result = result + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_result(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = result_result() + result.read(iprot) + iprot.readMessageEnd() + if result.aze is not None: + raise result.aze + return + + def fetchRequest(self, functionName): + """ + Parameters: + - functionName + """ + self.send_fetchRequest(functionName) + return self.recv_fetchRequest() + + def send_fetchRequest(self, functionName): + self._oprot.writeMessageBegin('fetchRequest', TMessageType.CALL, self._seqid) + args = fetchRequest_args() + args.functionName = functionName + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_fetchRequest(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = fetchRequest_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + if result.aze is not None: + raise result.aze + raise TApplicationException(TApplicationException.MISSING_RESULT, "fetchRequest failed: unknown result") + + def failRequest(self, id): + """ + Parameters: + - id + """ + self.send_failRequest(id) + self.recv_failRequest() + + def send_failRequest(self, id): + self._oprot.writeMessageBegin('failRequest', TMessageType.CALL, self._seqid) + args = failRequest_args() + args.id = id + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_failRequest(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = failRequest_result() + result.read(iprot) + iprot.readMessageEnd() + if result.aze is not None: + raise result.aze + return + + def failRequestV2(self, id, e): + """ + Parameters: + - id + - e + """ + self.send_failRequestV2(id, e) + self.recv_failRequestV2() + + def send_failRequestV2(self, id, e): + self._oprot.writeMessageBegin('failRequestV2', TMessageType.CALL, self._seqid) + args = failRequestV2_args() + args.id = id + args.e = e + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_failRequestV2(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = failRequestV2_result() + result.read(iprot) + iprot.readMessageEnd() + if result.aze is not None: + raise result.aze + return -class Iface: - def result(self, id, result): +class Processor(Iface, TProcessor): + def __init__(self, handler): + self._handler = handler + self._processMap = {} + self._processMap["result"] = Processor.process_result + self._processMap["fetchRequest"] = Processor.process_fetchRequest + self._processMap["failRequest"] = Processor.process_failRequest + self._processMap["failRequestV2"] = Processor.process_failRequestV2 + + 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_result(self, seqid, iprot, oprot): + args = result_args() + args.read(iprot) + iprot.readMessageEnd() + result = result_result() + try: + self._handler.result(args.id, args.result) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except AuthorizationException as aze: + msg_type = TMessageType.REPLY + result.aze = aze + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("result", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_fetchRequest(self, seqid, iprot, oprot): + args = fetchRequest_args() + args.read(iprot) + iprot.readMessageEnd() + result = fetchRequest_result() + try: + result.success = self._handler.fetchRequest(args.functionName) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except AuthorizationException as aze: + msg_type = TMessageType.REPLY + result.aze = aze + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("fetchRequest", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_failRequest(self, seqid, iprot, oprot): + args = failRequest_args() + args.read(iprot) + iprot.readMessageEnd() + result = failRequest_result() + try: + self._handler.failRequest(args.id) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except AuthorizationException as aze: + msg_type = TMessageType.REPLY + result.aze = aze + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("failRequest", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_failRequestV2(self, seqid, iprot, oprot): + args = failRequestV2_args() + args.read(iprot) + iprot.readMessageEnd() + result = failRequestV2_result() + try: + self._handler.failRequestV2(args.id, args.e) + msg_type = TMessageType.REPLY + except TTransport.TTransportException: + raise + except AuthorizationException as aze: + msg_type = TMessageType.REPLY + result.aze = aze + except TApplicationException as ex: + logging.exception('TApplication exception in handler') + msg_type = TMessageType.EXCEPTION + result = ex + except Exception: + logging.exception('Unexpected exception in handler') + msg_type = TMessageType.EXCEPTION + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("failRequestV2", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + +# HELPER FUNCTIONS AND STRUCTURES + + +class result_args(object): """ - Parameters: + Attributes: - id - result """ - pass - def fetchRequest(self, functionName): + + def __init__(self, id=None, result=None,): + self.id = id + self.result = result + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.result = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('result_args') + if self.id is not None: + oprot.writeFieldBegin('id', TType.STRING, 1) + oprot.writeString(self.id.encode('utf-8') if sys.version_info[0] == 2 else self.id) + oprot.writeFieldEnd() + if self.result is not None: + oprot.writeFieldBegin('result', TType.STRING, 2) + oprot.writeString(self.result.encode('utf-8') if sys.version_info[0] == 2 else self.result) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + 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) +all_structs.append(result_args) +result_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'id', 'UTF8', None, ), # 1 + (2, TType.STRING, 'result', 'UTF8', None, ), # 2 +) + + +class result_result(object): """ - Parameters: - - functionName + Attributes: + - aze """ - pass - def failRequest(self, id): + + def __init__(self, aze=None,): + self.aze = aze + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.aze = AuthorizationException() + self.aze.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('result_result') + if self.aze is not None: + oprot.writeFieldBegin('aze', TType.STRUCT, 1) + self.aze.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__.items()] + 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) +all_structs.append(result_result) +result_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'aze', [AuthorizationException, None], None, ), # 1 +) + + +class fetchRequest_args(object): """ - Parameters: - - id + Attributes: + - functionName """ - pass - def failRequestV2(self, id, e): + + def __init__(self, functionName=None,): + self.functionName = functionName + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.functionName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('fetchRequest_args') + if self.functionName is not None: + oprot.writeFieldBegin('functionName', TType.STRING, 1) + oprot.writeString(self.functionName.encode('utf-8') if sys.version_info[0] == 2 else self.functionName) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + 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) +all_structs.append(fetchRequest_args) +fetchRequest_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'functionName', 'UTF8', None, ), # 1 +) + + +class fetchRequest_result(object): """ - Parameters: - - id - - e + Attributes: + - success + - aze """ - pass - -class Client(Iface): - def __init__(self, iprot, oprot=None): - self._iprot = self._oprot = iprot - if oprot is not None: - self._oprot = oprot - self._seqid = 0 - def result(self, id, result): + def __init__(self, success=None, aze=None,): + self.success = success + self.aze = aze + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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 = DRPCRequest() + self.success.read(iprot) + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.aze = AuthorizationException() + self.aze.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('fetchRequest_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + oprot.writeFieldEnd() + if self.aze is not None: + oprot.writeFieldBegin('aze', TType.STRUCT, 1) + self.aze.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__.items()] + 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) +all_structs.append(fetchRequest_result) +fetchRequest_result.thrift_spec = ( + (0, TType.STRUCT, 'success', [DRPCRequest, None], None, ), # 0 + (1, TType.STRUCT, 'aze', [AuthorizationException, None], None, ), # 1 +) + + +class failRequest_args(object): """ - Parameters: + Attributes: - id - - result - """ - self.send_result(id, result) - self.recv_result() - - def send_result(self, id, result): - self._oprot.writeMessageBegin('result', TMessageType.CALL, self._seqid) - args = result_args() - args.id = id - args.result = result - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_result(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = result_result() - result.read(iprot) - iprot.readMessageEnd() - if result.aze is not None: - raise result.aze - return - - def fetchRequest(self, functionName): """ - Parameters: - - functionName - """ - self.send_fetchRequest(functionName) - return self.recv_fetchRequest() - - def send_fetchRequest(self, functionName): - self._oprot.writeMessageBegin('fetchRequest', TMessageType.CALL, self._seqid) - args = fetchRequest_args() - args.functionName = functionName - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_fetchRequest(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = fetchRequest_result() - result.read(iprot) - iprot.readMessageEnd() - if result.success is not None: - return result.success - if result.aze is not None: - raise result.aze - raise TApplicationException(TApplicationException.MISSING_RESULT, "fetchRequest failed: unknown result") - - def failRequest(self, id): + + + def __init__(self, id=None,): + self.id = id + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('failRequest_args') + if self.id is not None: + oprot.writeFieldBegin('id', TType.STRING, 1) + oprot.writeString(self.id.encode('utf-8') if sys.version_info[0] == 2 else self.id) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + 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) +all_structs.append(failRequest_args) +failRequest_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'id', 'UTF8', None, ), # 1 +) + + +class failRequest_result(object): """ - Parameters: - - id + Attributes: + - aze """ - self.send_failRequest(id) - self.recv_failRequest() - - def send_failRequest(self, id): - self._oprot.writeMessageBegin('failRequest', TMessageType.CALL, self._seqid) - args = failRequest_args() - args.id = id - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_failRequest(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = failRequest_result() - result.read(iprot) - iprot.readMessageEnd() - if result.aze is not None: - raise result.aze - return - - def failRequestV2(self, id, e): + + + def __init__(self, aze=None,): + self.aze = aze + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.aze = AuthorizationException() + self.aze.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('failRequest_result') + if self.aze is not None: + oprot.writeFieldBegin('aze', TType.STRUCT, 1) + self.aze.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__.items()] + 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) +all_structs.append(failRequest_result) +failRequest_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'aze', [AuthorizationException, None], None, ), # 1 +) + + +class failRequestV2_args(object): """ - Parameters: + Attributes: - id - e """ - self.send_failRequestV2(id, e) - self.recv_failRequestV2() - - def send_failRequestV2(self, id, e): - self._oprot.writeMessageBegin('failRequestV2', TMessageType.CALL, self._seqid) - args = failRequestV2_args() - args.id = id - args.e = e - args.write(self._oprot) - self._oprot.writeMessageEnd() - self._oprot.trans.flush() - - def recv_failRequestV2(self): - iprot = self._iprot - (fname, mtype, rseqid) = iprot.readMessageBegin() - if mtype == TMessageType.EXCEPTION: - x = TApplicationException() - x.read(iprot) - iprot.readMessageEnd() - raise x - result = failRequestV2_result() - result.read(iprot) - iprot.readMessageEnd() - if result.aze is not None: - raise result.aze - return -class Processor(Iface, TProcessor): - def __init__(self, handler): - self._handler = handler - self._processMap = {} - self._processMap["result"] = Processor.process_result - self._processMap["fetchRequest"] = Processor.process_fetchRequest - self._processMap["failRequest"] = Processor.process_failRequest - self._processMap["failRequestV2"] = Processor.process_failRequestV2 - - 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_result(self, seqid, iprot, oprot): - args = result_args() - args.read(iprot) - iprot.readMessageEnd() - result = result_result() - try: - self._handler.result(args.id, args.result) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except AuthorizationException as aze: - msg_type = TMessageType.REPLY - result.aze = aze - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("result", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_fetchRequest(self, seqid, iprot, oprot): - args = fetchRequest_args() - args.read(iprot) - iprot.readMessageEnd() - result = fetchRequest_result() - try: - result.success = self._handler.fetchRequest(args.functionName) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except AuthorizationException as aze: - msg_type = TMessageType.REPLY - result.aze = aze - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("fetchRequest", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_failRequest(self, seqid, iprot, oprot): - args = failRequest_args() - args.read(iprot) - iprot.readMessageEnd() - result = failRequest_result() - try: - self._handler.failRequest(args.id) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except AuthorizationException as aze: - msg_type = TMessageType.REPLY - result.aze = aze - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("failRequest", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() - - def process_failRequestV2(self, seqid, iprot, oprot): - args = failRequestV2_args() - args.read(iprot) - iprot.readMessageEnd() - result = failRequestV2_result() - try: - self._handler.failRequestV2(args.id, args.e) - msg_type = TMessageType.REPLY - except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): - raise - except AuthorizationException as aze: - msg_type = TMessageType.REPLY - result.aze = aze - except Exception as ex: - msg_type = TMessageType.EXCEPTION - logging.exception(ex) - result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') - oprot.writeMessageBegin("failRequestV2", msg_type, seqid) - result.write(oprot) - oprot.writeMessageEnd() - oprot.trans.flush() + def __init__(self, id=None, e=None,): + self.id = id + self.e = e + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.id = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.e = DRPCExecutionException() + self.e.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('failRequestV2_args') + if self.id is not None: + oprot.writeFieldBegin('id', TType.STRING, 1) + oprot.writeString(self.id.encode('utf-8') if sys.version_info[0] == 2 else self.id) + oprot.writeFieldEnd() + if self.e is not None: + oprot.writeFieldBegin('e', TType.STRUCT, 2) + self.e.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__.items()] + 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) +all_structs.append(failRequestV2_args) +failRequestV2_args.thrift_spec = ( + None, # 0 + (1, TType.STRING, 'id', 'UTF8', None, ), # 1 + (2, TType.STRUCT, 'e', [DRPCExecutionException, None], None, ), # 2 +) + + +class failRequestV2_result(object): + """ + Attributes: + - aze + """ -# HELPER FUNCTIONS AND STRUCTURES + def __init__(self, aze=None,): + self.aze = aze + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, [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.aze = AuthorizationException() + self.aze.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec])) + return + oprot.writeStructBegin('failRequestV2_result') + if self.aze is not None: + oprot.writeFieldBegin('aze', TType.STRUCT, 1) + self.aze.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__.items()] + 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) +all_structs.append(failRequestV2_result) +failRequestV2_result.thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'aze', [AuthorizationException, None], None, ), # 1 +) +fix_spec(all_structs) +del all_structs -class result_args: - """ - Attributes: - - id - - result - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'id', None, None, ), # 1 - (2, TType.STRING, 'result', None, None, ), # 2 - ) - - def __init__(self, id=None, result=None,): - self.id = id - self.result = result - - 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.id = iprot.readString().decode('utf-8') - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRING: - self.result = iprot.readString().decode('utf-8') - 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('result_args') - if self.id is not None: - oprot.writeFieldBegin('id', TType.STRING, 1) - oprot.writeString(self.id.encode('utf-8')) - oprot.writeFieldEnd() - if self.result is not None: - oprot.writeFieldBegin('result', TType.STRING, 2) - oprot.writeString(self.result.encode('utf-8')) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.id) - value = (value * 31) ^ hash(self.result) - return value - - 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 result_result: - """ - Attributes: - - aze - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 - ) - - def __init__(self, aze=None,): - self.aze = aze - - 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.aze = AuthorizationException() - self.aze.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('result_result') - if self.aze is not None: - oprot.writeFieldBegin('aze', TType.STRUCT, 1) - self.aze.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.aze) - return value - - 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 fetchRequest_args: - """ - Attributes: - - functionName - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'functionName', None, None, ), # 1 - ) - - def __init__(self, functionName=None,): - self.functionName = functionName - - 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.functionName = iprot.readString().decode('utf-8') - 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('fetchRequest_args') - if self.functionName is not None: - oprot.writeFieldBegin('functionName', TType.STRING, 1) - oprot.writeString(self.functionName.encode('utf-8')) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.functionName) - return value - - 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 fetchRequest_result: - """ - Attributes: - - success - - aze - """ - - thrift_spec = ( - (0, TType.STRUCT, 'success', (DRPCRequest, DRPCRequest.thrift_spec), None, ), # 0 - (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 - ) - - def __init__(self, success=None, aze=None,): - self.success = success - self.aze = aze - - 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 = DRPCRequest() - self.success.read(iprot) - else: - iprot.skip(ftype) - elif fid == 1: - if ftype == TType.STRUCT: - self.aze = AuthorizationException() - self.aze.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('fetchRequest_result') - if self.success is not None: - oprot.writeFieldBegin('success', TType.STRUCT, 0) - self.success.write(oprot) - oprot.writeFieldEnd() - if self.aze is not None: - oprot.writeFieldBegin('aze', TType.STRUCT, 1) - self.aze.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.success) - value = (value * 31) ^ hash(self.aze) - return value - - 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 failRequest_args: - """ - Attributes: - - id - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'id', None, None, ), # 1 - ) - - def __init__(self, id=None,): - self.id = id - - 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.id = iprot.readString().decode('utf-8') - 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('failRequest_args') - if self.id is not None: - oprot.writeFieldBegin('id', TType.STRING, 1) - oprot.writeString(self.id.encode('utf-8')) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.id) - return value - - 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 failRequest_result: - """ - Attributes: - - aze - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 - ) - - def __init__(self, aze=None,): - self.aze = aze - - 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.aze = AuthorizationException() - self.aze.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('failRequest_result') - if self.aze is not None: - oprot.writeFieldBegin('aze', TType.STRUCT, 1) - self.aze.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.aze) - return value - - 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 failRequestV2_args: - """ - Attributes: - - id - - e - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRING, 'id', None, None, ), # 1 - (2, TType.STRUCT, 'e', (DRPCExecutionException, DRPCExecutionException.thrift_spec), None, ), # 2 - ) - - def __init__(self, id=None, e=None,): - self.id = id - self.e = e - - 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.id = iprot.readString().decode('utf-8') - else: - iprot.skip(ftype) - elif fid == 2: - if ftype == TType.STRUCT: - self.e = DRPCExecutionException() - self.e.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('failRequestV2_args') - if self.id is not None: - oprot.writeFieldBegin('id', TType.STRING, 1) - oprot.writeString(self.id.encode('utf-8')) - oprot.writeFieldEnd() - if self.e is not None: - oprot.writeFieldBegin('e', TType.STRUCT, 2) - self.e.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.id) - value = (value * 31) ^ hash(self.e) - return value - - 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 failRequestV2_result: - """ - Attributes: - - aze - """ - - thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'aze', (AuthorizationException, AuthorizationException.thrift_spec), None, ), # 1 - ) - - def __init__(self, aze=None,): - self.aze = aze - - 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.aze = AuthorizationException() - self.aze.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('failRequestV2_result') - if self.aze is not None: - oprot.writeFieldBegin('aze', TType.STRUCT, 1) - self.aze.write(oprot) - oprot.writeFieldEnd() - oprot.writeFieldStop() - oprot.writeStructEnd() - - def validate(self): - return - - - def __hash__(self): - value = 17 - value = (value * 31) ^ hash(self.aze) - return value - - 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)
