thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger Meier (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-1745) Python JSON protocol
Date Fri, 02 Nov 2012 00:20:14 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-1745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13489162#comment-13489162
] 

Roger Meier commented on THRIFT-1745:
-------------------------------------

Committed the file, thanks for the contribution!

I did some integration into our cross language test suite  and some alignments of parameters
within test/py/TestServer.py and test/py/TestClient.py according to test/ThriftTest.thrift(see
THRIFT-847).

On my host the python test fails with json (hangs), so I did not add json to test/py/RunClientServer.py
yet.
Any idea why?

JSON does not pass all cross language test yet, see:
{noformat}
thrift-trunk/test$ sh test.sh
Apache Thrift - integration test suite
Fri Nov  2 00:49:00 CET 2012
======================================================
client-server:   protocol:   transport:        result:
cpp-cpp          binary      buffered-ip       success
cpp-cpp          binary      buffered-domain   success
cpp-cpp          binary      framed-ip         success
cpp-cpp          binary      framed-domain     success
cpp-cpp          binary      http-ip           success
cpp-cpp          binary      http-domain       success
cpp-cpp          json        buffered-ip       success
cpp-cpp          json        buffered-domain   success
cpp-cpp          json        framed-ip         success
cpp-cpp          json        framed-domain     success
cpp-cpp          json        http-ip           success
cpp-cpp          json        http-domain       success
py-py            binary      buffered-ip       success
py-py            json        buffered-ip       success
py-cpp           binary      buffered-ip       success
py-cpp           json        buffered-ip       failure
=================== server message ===================
Starting "simple" server (buffered/json) listen on: 9090
Thrift: Fri Nov  2 00:54:50 2012 TSimpleServer client died: No more data to read.
=================== client message ===================
  File "py/gen-py/ThriftTest/ThriftTest.py", line 1995, in read
    (fname, ftype, fid) = iprot.readFieldBegin()
  File "py/../../lib/py/build/lib.linux-x86_64-2.6/thrift/protocol/TJSONProtocol.py", line
322, in readFieldBegin
    type = JTYPES[self.readJSONString(False)]
KeyError: 'rec'

----------------------------------------------------------------------
Ran 18 tests in 2.016s

FAILED (errors=4)
======================================================

client-server:   protocol:   transport:        result:
cpp-py           binary      buffered-ip       failure
=================== server message ===================
Traceback (most recent call last):
  File "py/../../lib/py/build/lib.linux-x86_64-2.6/thrift/server/TServer.py", line 84, in
serve
    self.processor.process(iprot, oprot)
  File "py/gen-py/ThriftTest/ThriftTest.py", line 1006, in process
    self._processMap[name](self, seqid, iprot, oprot)
  File "py/gen-py/ThriftTest/ThriftTest.py", line 1170, in process_testMapMap
    result.write(oprot)
  File "py/gen-py/ThriftTest/ThriftTest.py", line 3054, in write
    oprot.writeMapBegin(TType.I32, TType.MAP, len(self.success))
TypeError: object of type 'int' has no len()
=================== client message ===================
testMap({0 => -10, 1 => -9, 2 => -8, 3 => -7, 4 => -6}) = {0 => -10, 1 =>
-9, 2 => -8, 3 => -7, 4 => -6}
testSet({-2, -1, 0, 1, 2}) = {-2, -1, 0, 1, 2}
testList({-2, -1, 0, 1, 2}) = {-2, -1, 0, 1, 2}
testEnum(ONE) = 1
testEnum(TWO) = 2
testEnum(THREE) = 3
testEnum(FIVE) = 5
testEnum(EIGHT) = 8
testTypedef(309858235082523) = 309858235082523
testMapMap(1)Aborted
======================================================

client-server:   protocol:   transport:        result:
cpp-py           json        buffered-ip       failure
=================== server message ===================
    self.processor.process(iprot, oprot)
  File "py/gen-py/ThriftTest/ThriftTest.py", line 1006, in process
    self._processMap[name](self, seqid, iprot, oprot)
  File "py/gen-py/ThriftTest/ThriftTest.py", line 1077, in process_testStruct
    args.read(iprot)
  File "py/gen-py/ThriftTest/ThriftTest.py", line 1935, in read
    (fname, ftype, fid) = iprot.readFieldBegin()
  File "py/../../lib/py/build/lib.linux-x86_64-2.6/thrift/protocol/TJSONProtocol.py", line
322, in readFieldBegin
    type = JTYPES[self.readJSONString(False)]
KeyError: 'rec'
=================== client message ===================
terminate called after throwing an instance of 'apache::thrift::transport::TTransportException'
  what():  No more data to read.
Test #1, connect localhost:9090
testVoid() = void
testString("Test") = "Test"
testByte(1) = 1
testI32(-1) = -1
testI64(-34359738368) = -34359738368
testDouble(-5.2098523) = -5.209852
testStruct({"Zero", 1, -3, -5})Aborted
======================================================

client-server:   protocol:   transport:        result:
py-java          binary      buffered-ip       success
py-java          json        buffered-ip       failure
=================== server message ===================
    [javac] Compiling 2 source files to thrift-trunk/lib/java/build/test
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
      [jar] Building jar: thrift-trunk/lib/java/build/libthrift-1.0.0-test.jar

testserver:
     [java] Starting the server on port 9090...
     [java] TServerEventHandler.preServe - called only once before server starts accepting
connections
     [java] TServerEventHandler.createContext - connection #1 established
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
=================== client message ===================
  File "py/../../lib/py/build/lib.linux-x86_64-2.6/thrift/transport/TTransport.py", line 149,
in open
    return self.__trans.open()
  File "py/../../lib/py/build/lib.linux-x86_64-2.6/thrift/transport/TSocket.py", line 99,
in open
    message=message)
TTransportException: Could not connect to localhost:9090

----------------------------------------------------------------------
Ran 18 tests in 10.389s

FAILED (errors=18)
======================================================

client-server:   protocol:   transport:        result:
java-py          binary      buffered-ip       success
java-java        binary      buffered-ip       success
cpp-java         binary      buffered-ip       failure
=================== server message ===================
     [java] testMultiException(Xception2, test 2)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testMultiException(success, test 3)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testOneway(3) => sleeping...
     [java] Done sleeping!
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testI32(-1)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] TServerEventHandler.deleteContext - connection #1 terminated
=================== client message ===================
testClient.testMultiException("Xception2", "test 2") =>  {2002, {"This is an Xception2"}}
testClient.testMultiException("success", "test 3") =>  {{"test 3"}}
testClient.testOneway(3) =>  success - took 0.01 ms
re-test testI32(-1) = -1
Total time: 3194210 us

All tests done.
Min time: 3194210 us
Max time: 3194210 us
Avg time: 3194210 us
======================================================

client-server:   protocol:   transport:        result:
cpp-java         json        buffered-ip       failure
=================== server message ===================
     [java] testMultiException(Xception2, test 2)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testMultiException(success, test 3)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testOneway(3) => sleeping...
     [java] Done sleeping!
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testI32(-1)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] TServerEventHandler.deleteContext - connection #1 terminated
=================== client message ===================
testClient.testMultiException("Xception2", "test 2") =>  {2002, {"This is an Xception2"}}
testClient.testMultiException("success", "test 3") =>  {{"test 3"}}
testClient.testOneway(3) =>  success - took 0.00 ms
re-test testI32(-1) = -1
Total time: 3213776 us

All tests done.
Min time: 3213776 us
Max time: 3213776 us
Avg time: 3213776 us
======================================================

client-server:   protocol:   transport:        result:
js-java          json        http-ip           success
cpp-java         binary      buffered-ip       failure
=================== server message ===================
     [java] testMultiException(Xception2, test 2)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testMultiException(success, test 3)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testOneway(3) => sleeping...
     [java] Done sleeping!
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testI32(-1)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] TServerEventHandler.deleteContext - connection #1 terminated
=================== client message ===================
testClient.testMultiException("Xception2", "test 2") =>  {2002, {"This is an Xception2"}}
testClient.testMultiException("success", "test 3") =>  {{"test 3"}}
testClient.testOneway(3) =>  success - took 0.01 ms
re-test testI32(-1) = -1
Total time: 3194210 us

All tests done.
Min time: 3194210 us
Max time: 3194210 us
Avg time: 3194210 us
======================================================

client-server:   protocol:   transport:        result:
cpp-java         json        buffered-ip       failure
=================== server message ===================
     [java] testMultiException(Xception2, test 2)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testMultiException(success, test 3)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testOneway(3) => sleeping...
     [java] Done sleeping!
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] testI32(-1)
     [java] TServerEventHandler.processContext - connection #1 is ready to process next request
     [java] TServerEventHandler.deleteContext - connection #1 terminated
=================== client message ===================
testClient.testMultiException("Xception2", "test 2") =>  {2002, {"This is an Xception2"}}
testClient.testMultiException("success", "test 3") =>  {{"test 3"}}
testClient.testOneway(3) =>  success - took 0.00 ms
re-test testI32(-1) = -1
Total time: 3213776 us

All tests done.
Min time: 3213776 us
Max time: 3213776 us
Avg time: 3213776 us
======================================================

client-server:   protocol:   transport:        result:
js-java          json        http-ip           success
java-cpp         binary      buffered-ip       success
perl-cpp         binary      buffered-ip       success

{noformat}
                
> Python JSON protocol 
> ---------------------
>
>                 Key: THRIFT-1745
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1745
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Python - Library
>    Affects Versions: 1.0
>            Reporter: Frederic Delbos
>            Assignee: Roger Meier
>            Priority: Minor
>         Attachments: TJSONProtocol.py
>
>
> I write a JSON protocol for Python available here :  https://gist.github.com/3948701
So far it passes all the tests.
> Also you need to add json to the python test suit and 'TJSONProtocol' in  lib/py/src/protocol/__init__.py
> cheers

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message